Factorio Server
Stack
Headless Factorio via factoriotools/factorio - the community-standard image. Saves, mods, and server settings live on the /factorio volume; a new map generates on first boot and the latest save loads thereafter.
Image details
Configuration
TypeComposelinuxfactoriotools/factorio:stable34197:34197/udp/factorio : factoriodataLOAD_LATEST_SAVE=trueGENERATE_NEW_SAVE=trueSAVE_NAME=${SAVE_NAME:-miget}UPDATE_MODS_ON_START=${UPDATE_MODS_ON_START:-false}unless-stoppedTemplate by deployable-sh·Source
Report issueStandalone Install
Select an install method, to see config/commands for deploying Factorio Server
Install on Portainer
Import all app templates into your Portainer instance, for easy 1-click deploys
- Ensure both Docker and Portainer are installed, and up-to-date
- Log into your Portainer web UI
- Under Settings → App Templates, paste the below URL
- Head to Home → App Templates, and the list of apps will show up
- Select Factorio Server, fill in any config options, and hit Deploy
Template Import URL
https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me
Original stackfile
The compose file this template deploys, straight from its repo:
name: factorio
services:
factorio:
image: factoriotools/factorio:stable
restart: unless-stopped
environment:
LOAD_LATEST_SAVE: "true"
GENERATE_NEW_SAVE: "true"
SAVE_NAME: ${SAVE_NAME:-miget}
UPDATE_MODS_ON_START: ${UPDATE_MODS_ON_START:-false}
ports:
- "34197:34197/udp"
volumes:
- factoriodata:/factorio
volumes:
factoriodata:
Or deploy it directly from the source:
git clone https://github.com/deployable-sh/stacks
cd stacks
docker compose -f factorio/compose.yaml up -dMore install options in our documentation.
Factorio

!NOTE
ARM64 images for Factorio 2.1 and newer run the native linux-arm64 headless build. Older versions have no native build and run the x64 build under box64 emulation, which is experimental: expect crashes and lag if you try to run those on a raspberry pi.中文
latest, 2.1.24
Tag descriptions
latest- most up-to-date version (may be experimental).stable- version declared stable on factorio.com (FFF-435 Since 2.0 versions gets released as experimental first, once stable it will be marked as stable).stable-x.y.z- a specific stable release; constrain update tools to this prefix to exclude experimental releases. Rootless equivalents end in-rootless.0.x- latest version in a branch.0.x.y- a specific version.0.x-z- incremental fix for that version.
What is Factorio?
Factorio is a game in which you build and maintain factories.You will be mining resources, researching technologies, building infrastructure, automating production and fighting enemies. Use your imagination to design your factory, combine simple elements into ingenious structures, apply management skills to keep it working and finally protect it from the creatures who don't really like you.
The game is very stable and optimized for building massive factories. You can create your own maps, write mods in Lua or play with friends via Multiplayer.
NOTE: This is only the server. The full game is available at Factorio.com, Steam, GOG.com and Humble Bundle.
Usage
Quick Start
Run the server to create the necessary folder structure and configuration files. For this example data is stored in/opt/factorio.sudo mkdir -p /opt/factorio
sudo chown 845:845 /opt/factorio
sudo docker run -d \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
--name factorio \
--restart=unless-stopped \
factoriotools/factorioFor those new to Docker, here is an explanation of the options:
-d- Run as a daemon ("detached").-p- Expose ports.-v- Mount/opt/factorioon the local file system to/factorioin the container.--restart- Restart the server if it crashes and at system start--name- Name the container "factorio" (otherwise it has a funny random name).
The
chown command is needed because in 0.16+, we no longer run the game server as root for security reasons, but rather as a 'factorio' user with user id 845. The host must therefore allow these files to be written by that user.Check the logs to see what happened:
docker logs factorioStop the server:
docker stop --timeout 120 factorioAllow enough time for the world to save before Docker sends SIGKILL. Increase the timeout for large saves; with Compose, configure
stop_grace_period instead.Now there's a
server-settings.json file in the folder /opt/factorio/config. Modify this to your liking and restart the server:docker start factorioTry to connect to the server. Check the logs if it isn't working.
Console
To issue console commands to the server, start the server in interactive mode with-it. Open the console with docker attach and then type commands.docker run -d -it \
--name factorio \
factoriotools/factorio
docker attach factorioRCON (2.0.18+)
Alternativly (e.g. for scripting) the RCON connection can be used to send commands to the running factorio server. This does not require the RCON connection to be exposed.docker exec factorio rcon /hServer health
Regular and rootless images check server responsiveness using the read-onlyrcon /players count command, with a five-second timeout. RCON does not need to be published, and the check does not affect achievements.docker inspect --format '{{.State.Health.Status}}' factorioThe default interval is 30 seconds, with three retries and a five-minute startup grace period. For large saves or heavy mod sets, adjust Compose
healthcheck.start_period, interval and retries to allow for loading and save pauses. Use healthcheck.disable: true (or docker run --no-healthcheck) if you intentionally disable or replace RCON.Docker reports
starting, healthy or unhealthy; it does not automatically restart unhealthy containers. Use this status with your monitoring tool. The check does not test external UDP connectivity or provide an HTTP endpoint. Keep the Docker API and RCON private.Upgrading
Before upgrading backup the save. It's easy to make a save in the client.Ensure
-v was used to run the server so the save is outside of the Docker container. The docker rm command completely destroys the container, which includes the save if it isn't stored in a data volume.Delete the container and refresh the image:
docker stop factorio
docker rm factorio
docker pull factoriotools/factorioNow run the server as before. In about a minute the new version of Factorio should be up and running, complete with saves and config!
Saves
A new map named_autosave1.zip (or SAVE_NAME when set) is generated the first time the server is started. The map-gen-settings.json and map-settings.json files in /opt/factorio/config are used for the map settings. On subsequent runs the newest save is used.To load an old save stop the server and run the command
touch oldsave.zip. This resets the date. Then restart the server. Another option is to delete all saves except one.To generate a new map stop the server, delete all of the saves and restart the server.
Specify a save directly (0.17.79-2+)
You can specify a specific save to load by configuring the server through a set of environment variables:To load an existing save, set
SAVE_NAME to its name in the saves directory, with or without .zip, or to an absolute file path. The same path is used for generation and subsequent starts. A missing selected save produces an error rather than loading another world:sudo docker run -d \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
-e LOAD_LATEST_SAVE=false \
-e SAVE_NAME=replaceme \
--name factorio \
--restart=unless-stopped \
factoriotools/factorioTo generate a new map set
GENERATE_NEW_SAVE=true and specify SAVE_NAME:sudo docker run -d \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
-e LOAD_LATEST_SAVE=false \
-e GENERATE_NEW_SAVE=true \
-e SAVE_NAME=replaceme \
--name factorio \
--restart=unless-stopped \
factoriotools/factorioTo generate a new map with a specific preset (e.g., death-world):
sudo docker run -d \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
-e LOAD_LATEST_SAVE=false \
-e GENERATE_NEW_SAVE=true \
-e SAVE_NAME=replaceme \
-e PRESET=death-world \
--name factorio \
--restart=unless-stopped \
factoriotools/factorioMods
Copy mods into the mods folder and restart the server.As of 0.17 a new environment variable was added `
UPDATE_MODS_ON_START which if set to true` will cause the mods get to updated on server start. If set a valid Factorio Username and Token must be supplied or else the server will not start. They can either be set as docker secrets, environment variables, or pulled from the server-settings.json file.To prevent specific mods from being automatically updated, you can use the `
UPDATE_IGNORE environment variable with a comma-separated list of mod names. For example: UPDATE_IGNORE=mod1,mod2,mod3` will skip updates for those three mods. This can be useful to prevent compatibility issues when certain mods should remain at specific versions. Be warned that it can also create compatibility issues.Note: When using the Space Age DLC, the built-in mods (
elevated-rails, quality, and space-age) are automatically skipped during mod updates to prevent conflicts. These mods are included with the DLC and should not be downloaded separately.Scenarios
If you want to launch a scenario from a clean start (not from a saved map) you'll need to start the docker image from an alternate entrypoint. To do this, use the example entrypoint file stored in the /factorio/entrypoints directory in the volume, and launch the image with the following syntax. Note that this is the normal syntax with the addition of the --entrypoint setting AND the additional argument at the end, which is the name of the Scenario in the Scenarios folder.docker run -d \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
--name factorio \
--restart=unless-stopped \
--entrypoint "/scenario.sh" \
factoriotools/factorio \
MyScenarioNameConverting Scenarios to Regular Maps (deprecated)
The legacy/scenario2map.sh wrapper is retained for compatibility, but is deprecated for new deployments. Factorio's --scenario2map operation does not apply map-gen-settings.json or map-settings.json; copying those files does not make conversion honor them. See the upstream explanation.Instead, use
/scenario.sh as described above to start a scenario with the desired map settings, then save the running world through the console or RCON (/server-save). After confirming the save completed, stop the container and use the normal entrypoint to load that save. Keep a backup before changing an existing world.RCON
Set the RCON password in therconpw file. A random password is generated if rconpw doesn't exist.To change the password, stop the server, modify
rconpw, and restart the server.To "disable" RCON don't expose port 27015, i.e. start the server without
-p 27015:27015/tcp. RCON is still running, but nobody can to connect to it.Whitelisting (0.15.3+)
Create fileconfig/server-whitelist.json and add the whitelisted users.[
"you",
"friend"
]Banlisting (0.17.1+)
Create fileconfig/server-banlist.json and add the banlisted users.[
"bad_person",
"other_bad_person"
]Adminlisting (0.17.1+)
Create fileconfig/server-adminlist.json and add the adminlisted users.[
"you",
"friend"
]Customize configuration files (0.17.x+)
Factorio does not expand environment variables inside JSON. Prefer mounting a complete settings file (seeSERVER_SETTINGS_FILE below). If you need per-instance values from Compose, the image already includes jq, which safely encodes quotes, backslashes and newlines instead of doing raw text substitution.First create a complete, valid
server-settings.json template, for example by copying data/config/server-settings.json after the initial startup. The following example mounts that template read-only and renders a separate settings file on every start. Supplied variables override the template; unset variables preserve its values. This intentionally regenerates the output file: edit the template, not the generated copy.services:
factorio:
image: factoriotools/factorio:stable
ports:
- "34197:34197/udp"
volumes:
- ./data:/factorio
- ./server-settings.json:/server-settings.template.json:ro
environment:
INSTANCE_NAME: "My Factorio server"
INSTANCE_DESC: "A server configured through Compose"
# Optional: USERNAME, TOKEN and GAME_PASSWORD override the matching fields.
# Keep credentials out of version control.
entrypoint:
- /bin/sh
- -ec
- |
mkdir -p /factorio/config
jq '
.name = (env.INSTANCE_NAME // .name) |
.description = (env.INSTANCE_DESC // .description) |
.username = (env.USERNAME // .username) |
.token = (env.TOKEN // .token) |
.game_password = (env.GAME_PASSWORD // .game_password)
' /server-settings.template.json > /factorio/config/server-settings.json.tmp
mv /factorio/config/server-settings.json.tmp /factorio/config/server-settings.json
exec /docker-entrypoint.sh
These settings variables are consumed by this example wrapper, not by the normal entrypoint. Set
visibility.public explicitly in the template; public listing also needs valid Factorio credentials. For rootless images, the generated file's directory must already be writable by the container UID.Environment Variables
These are the environment variables which can be specified at container run time.| Variable Name | Description | Default | Available in |
|---|---|---|---|
| PUID | Server user ID in regular images; use id -u to find your host user ID | 845 | Regular images |
| PGID | Server group ID in regular images; use id -g to find your host group ID | 845 | Regular images |
| GENERATENEWSAVE | Generate a new save if one does not exist before starting the server | false | 0.17+ |
| LOADLATESTSAVE | Load latest when true. Otherwise load SAVENAME | true | 0.17+ |
| PORT | UDP port the server listens on | 34197 | 0.15+ |
| BIND | IP address (v4 or v6) the server listens on (IP\[:PORT) | 0.15+ | |
| RCONPORT | TCP port the rcon server listens on | 27015 | 0.15+ |
| SAVENAME | Name to use for the save file | autosave1 | 0.17+ |
| PRESET | Map generation preset when GENERATENEWSAVE is true | 0.17+ | |
| TOKEN | factorio.com token for mod updates (server listing uses settings JSON) | 0.17+ | |
| UPDATEMODSONSTART | If mods should be updated before starting the server | 0.17+ | |
| UPDATEIGNORE | Comma-separated list of mod names to skip during automatic updates | 0.17+ | |
| USERNAME | factorio.com username for mod updates (server listing uses settings JSON) | 0.17+ | |
| CONSOLELOGLOCATION | Saves the console log to the specifies location | ||
| DLCSPACEAGE | Enables or disables the mods for DLC Space Age in mod-list.json^1 | true | 2.0.8+ |
| MODS | Mod directory to use | /factorio/mods | 2.0.8+ |
| SERVERSETTINGSFILE | Absolute path to server settings | $CONFIG/server-settings.json | New builds |
| SERVERIDFILE | Absolute path to server identity | $CONFIG/server-id.json | New builds |
| SERVERADMINLISTFILE | Absolute path to the server admin list | $CONFIG/server-adminlist.json | New builds |
| SERVERBANLISTFILE | Absolute path to the server ban list | $CONFIG/server-banlist.json | New builds |
| SERVERWHITELISTFILE | Absolute path to the server whitelist | $CONFIG/server-whitelist.json | New builds |
Note: All environment variables are compared as strings. Quote YAML mapping values, for example
DLC_SPACE_AGE: "false". In list syntax, quote the whole item (- "DLC_SPACE_AGE=elevated-rails"), not only the value: - DLC_SPACE_AGE="elevated-rails" passes literal quotation marks to the container.An explicit port in
BIND overrides PORT, for example 127.0.0.1:34201 or [::1]:34201. A bare IPv6 address still uses PORT.Host file ownership
The regular image starts as root, adjusts ownership inside/factorio, and runs the server as PUID:PGID (845:845 by default). To keep a bind-mounted data directory owned by your host user, set these to the numeric output of id -u and id -g. Changing them changes ownership of the mounted data, so use a dedicated directory—not your entire home directory.Relative bind paths such as
./data:/factorio are convenient but do not bypass filesystem permissions. With --user, a rootless container engine, or a rootless image, prepare the host directory for the actual container UID/GID and any user-namespace mapping. PUID/PGID do not change identity in the rootless image; its default is 1000:1000.Server configuration paths
TheSERVER_*_FILE overrides apply to regular and rootless images, including scenario startup. Upgrade or rebuild older images to use this feature. Unset or empty values use the defaults above; $CONFIG defaults to /factorio/config. The mod updater also reads credentials from SERVER_SETTINGS_FILE unless credentials are supplied explicitly or through Docker secrets.Use absolute file paths, not directory paths. Existing settings are preserved; if
SERVER_SETTINGS_FILE is missing, the default settings are copied there. For example, -e SERVER_SETTINGS_FILE=/factorio/config/private/settings.json selects a separate settings file.Parent directories are created when possible. Custom settings files must be readable by the server user. Files that Factorio updates (including its server ID and player lists), and their parent directories, must be writable by that user. For paths outside
/factorio, pre-create directories with the appropriate permissions: the regular image only adjusts ownership inside /factorio, and the rootless image does not adjust ownership. An existing read-only settings-file mount is supported; a missing settings file in a read-only directory is not.PRESET Values
ThePRESET environment variable is used when generating a new map (when GENERATE_NEW_SAVE=true). It corresponds to Factorio's built-in map generation presets. Common values include:default- Normal settingsrich-resources- Resources are more abundantmarathon- Recipes and technologies are more expensivedeath-world- Biters are more aggressive and numerousdeath-world-marathon- Combines death-world and marathon settingsrail-world- Resources are further apart, encouraging train usageribbon-world- Map height is limited for a unique challenge
If PRESET is not specified or left empty, the map will be generated using the settings from
map-gen-settings.json and map-settings.json without a preset.Building images
Normal deployments should pull published images rather than build them. For development, runpython3 build.py --both from the repository root to build regular and rootless variants. Add --multiarch --push-tags only when you intend to publish images and have registry credentials configured.Use
--changed-from GIT_REF to build only releases with new versions, changed archive checksums or added tags. Removing a tag alone does not trigger a rebuild. Automatic release updates use this mode; runtime/build-source changes and manual workflow runs rebuild all current versions.Omit
--changed-from to retry a failed publication or refresh base layers.Container Details
The philosophy is to keep it simple.- The server should bootstrap itself.
- Prefer configuration files over environment variables.
- Use one volume for data.
Volumes
To keep things simple, the container uses a single volume mounted at/factorio. This volume stores configuration, mods, and saves.The files in this volume should be owned by the factorio user, uid 845.
factorio
|-- config
| |-- map-gen-settings.json
| |-- map-settings.json
| |-- rconpw
| |-- server-adminlist.json
| |-- server-banlist.json
| |-- server-settings.json
| `-- server-whitelist.json
|-- mods
| `-- fancymod.zip
`-- saves
`-- _autosave1.zipDocker Compose
Use the current Docker Compose plugin (docker compose) and the repository-root docker-compose.yml. It runs the published factoriotools/factorio:stable image and stores data in ./data alongside the Compose file. No source build, VERSION build argument or download checksum is needed.git clone https://github.com/factoriotools/factorio-docker.git
cd factorio-docker
docker compose up -d
docker compose logs factorio
docker compose stop factorioBefore restarting, configure
data/config/server-settings.json: set visibility.public to false for an unlisted server, or supply valid Factorio username and token for public listing. Set a game password or whitelist as appropriate. USERNAME and TOKEN environment variables normally configure the mod updater, not public listing; use the JSON file or the explicit provisioning wrapper above for server settings. See host file ownership above if you cannot edit the generated files.docker compose up -d factorioTo update, back up
data first, then pull and recreate the service in the same Compose directory with the same volume mapping:docker compose pull factorio
docker compose up -d factorioThe image tag selects the game version. Use
stable for the current stable release or pin a version compatible with your clients; latest may be experimental. Pulling a new image alone does not replace an existing container. Do not delete the data directory during an update.docker/docker-compose.yml is a developer source-build example, not the normal installation path. Its VERSION, SHA256 and optional SHA256_ARM64 arguments verify downloaded game archives. Keep checksum verification enabled when building from source; use the published-image example if you do not want to maintain build arguments.Ports
34197/udp- Game server (required). This can be changed with thePORTenvironment variable.27015/tcp- RCON (optional).
LAN Games
Ensure thelan setting in server-settings.json is true."visibility":
{
"public": false,
"lan": true
},Start the container with the
--network=host option so clients can automatically find LAN games. Refer to the Quick Start to create the /opt/factorio directory.sudo docker run -d \
--network=host \
-p 34197:34197/udp \
-p 27015:27015/tcp \
-v /opt/factorio:/factorio \
--name factorio \
--restart=unless-stopped \
factoriotools/factorioDeploy to other plaforms
Vagrant
Vagrant is a easy way to setup a virtual machine (VM) to run Docker. The Factorio Vagrant box repository contains a sample Vagrantfile.For LAN games the VM needs an internal IP in order for clients to connect. One way to do this is with a public network. The VM uses DHCP to acquire an IP address. The VM must also forward port 34197.
config.vm.network "public_network"
config.vm.network "forwarded_port", guest: 34197, host: 34197Amazon Web Services (AWS) Deployment
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the Factorio Server Deployment (CloudFormation) repository(https://github.com/m-chandler/factoCheck the logs first
Nine times out of ten the logs tell you exactly what went wrong.
- In Portainer, go to Containers, click the container, then Logs. Or run
docker logs <container> - Exit codes help too:
137means killed, usually out of memory.126or127means the command inside the image is broken.
Port already in use
If deployment fails with "Bind for 0.0.0.0:34197 failed: port is already allocated", something else on your server is using that port.
- Find what's using it:
sudo ss -tlnp | grep :34197 - Stop the other service, or pick a different host port. In
34197:34197only the left number is yours to change, the right one belongs to the app.
Image won't pull
Test the pull directly on the host: docker pull factoriotools/factorio:stable
- "manifest unknown" means the tag no longer exists.
- "toomanyrequests" is the Docker Hub rate limit. Log in with
docker loginto raise it. - "no space left on device" means a full disk. Reclaim space with
docker system prune
"exec format error"
This means the image was built for a different CPU architecture than your server.
- This image supports:
amd64, arm64 - Check yours with
uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.
Container keeps restarting
The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.
- Check the logs right after a restart, the last few lines before it died are the useful ones.
- Get the exit code with
docker inspect <container> --format '{{.State.ExitCode}}' - Still stuck? Redeploy once with the restart policy set to
noso the failure stays visible.
Stack won't deploy
Compose stacks fail fast on small mistakes, and Portainer shows the reason just above the editor.
- YAML only accepts spaces for indentation, a single tab breaks the whole file.
Raise an issue
Found something which isn't working as it should? Here's how to report it.
- Bug within the app: Open an issue within factorio's repo
- Template not working: Open an issue on deployable-sh/stacks
- This website not working: Open an issue on lissy93/portainer-templates
A Compose stack
Factorio Server is a Compose stack, a set of containers defined in one file and brought up together by Portainer, then started and stopped as a single app.
The app image
An image is the app packed up ready to go, everything Factorio Server needs bundled into one download. This template pulls factoriotools/factorio:stable, which Docker fetches once (about 209 MB) and then starts your own copy from.
Where the image comes from
Docker pulls its images from registries, public libraries of ready-built apps. Factorio Server's comes from Docker Hub, published by factoriotools.
Version tags
The bit after the colon in the image name is the version tag. This one pins stable, so every redeploy gives you that exact build until you bump it yourself.
Which machines it runs on
Every image is built for particular CPU types. This one ships for amd64, arm64, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.
Ports
A port is the door the app answers on. A mapping like 34197:34197 means it's reachable on port 34197 of your server, where the left number is yours to change and the right one belongs to the app. It opens:
34197:34197over UDP
Volumes
A volume is where Factorio Server keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:
/factoriokept in thefactoriodatavolume Docker manages
Environment variables
Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Factorio Server takes 4 of them, all with defaults you can leave alone or tweak:
LOAD_LATEST_SAVE, defaults totrueGENERATE_NEW_SAVE, defaults totrueSAVE_NAME, defaults tomigetUPDATE_MODS_ON_START, defaults tofalse
Restart policy
The restart policy here is unless-stopped, so Docker restarts Factorio Server after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).
Networking
Nothing custom is set, so Factorio Server sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.
Container name
Once it's deployed, Portainer names the container factorio. That's what you'll spot in the containers list and use in commands like docker logs factorio.
Platform
The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.
Portainer app templates
Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Factorio Server up. Add the template list to Portainer once, then deploying Factorio Server is a click rather than a wall of config.