Skip to content

DOCKER FACTORIO DEDICATED SERVER

Here is how to setup a Factorio dedicated server inside of a Docker container.

SETUP FACTORIO IN A DOCKER CONTAINER

I will presume that you are to use an EL7 host. Adjust accordingly for other host OS's.

  1. Install docker

    sudo yum -y install docker
    
  2. Pull in docker images

    sudo docker pull fedora
    
  3. Select volume path (make dirs if needed)

    mkdir /storage/location/docker/factorio
    
  4. Factorio server start script, this goes in your volume

    #!/bin/bash                                                                                                                                                                      
    BINPATH=/home/steam/Steam/steamapps/common/Factorio/
    SAVEGAME=./saves/SAVEGAME.zip
    
    #Update Factorio via steam (managed by separate script)
    cd ~/Steam
    ./steamcmd.sh +login YOUR_STEAM_USER +app_update 427520 +quit
    
    #Start Factorio via steam install
    cd $BINPATH
    ./bin/x64/factorio --start-server $SAVEGAME
    
  5. Dockerfile

    FROM fedora:latest
    RUN dnf -y update
    RUN dnf -y install glibc libstdc++ glibc.i686 \
                    libstdc++.i686 \
                    vim wget curl \
                    tar unzip bzip \
                    alsa-lib libX11 libXcursor libXinerama libXrandr libXi libGL libxcb
                    steamcmd
    RUN dnf -y clean all
    RUN ldconfig
    RUN useradd steam
    USER steam
    ENV HOME /home/steam
    CMD /bin/bash
    
  6. Build dockerfile

    docker build -t "factorio-fedora:latest" .
    
  7. Docker startup script

    #!/bin/bash
    docker run -ti --rm --sig-proxy=false --privileged=true\
                    -p=34197:34197/udp\
                    -m=1g\
                    -v /storage/docker/steamcmd/factorio/:/home/steam/Steam\
                    --name=factorio\
                    -w=/home/steam/Steam factorio-fedora:latest /home/steam/Steam/start-factorio.sh
    
  8. Setup volume

    sudo docker run -ti --rm --sig-proxy=false --privileged=true -p=34197:34197/udp -m=1g\
                    -v /storage/docker/steamcmd/factorio/:/home/steam/Steam\
                    --name=factorio factorio-fedora:latest /bin/bash
    
    cd ~/Steam
    curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
    ./steamcmd +quit