Factorio Server – Using Docker

Factorio – One of the greatest games created. Here we will go through how to create a server using docker and docker-swarm for both a quick deployment and high availability.


Docker Single Node

When using a single docker node, it can be created using the following docker-compose file. The image can be found at DockerHub and more detailed descriptions on what the image supports and much more.

version: "3.10"

services:
  factorio:
    image: factoriotools/factorio:1.1.104 # Select the version you need
    volumes:
      - factorio_data:/factorio
# Optionally, create a bind instead for a local simple access to save directory.
#      - type: bind
#        source: ./factorio_save 
#        target: /factorio
    ports:
      - 34197:34197/udp
      - 27015:27015/tcp

volumes:
  factorio_data:
    driver: local

Save the content to a file called factorio-compose-single.yml or whatever you like. After, the server can be created by using the following command. It will create and setup Factorio running on the host computer where the command was invoked from.

 docker compose -f factorio-compose-single.yml up

Docker Run – Quick Setup

The server can also be setup quickly using the Docker run.

docker run -d \
  -p 34197:34197/udp \
  -p 27015:27015/tcp \
  -v /opt/factorio:/factorio \
  --name factorio \
  --restart=unless-stopped \
  factoriotools/factorio