Lightweight, low-config Factorio server with support for interactive and non-interactive commands
3.8K
A small, simple containerized Factorio server that supports interactive and non-interactive server commands. Suitable for local and hosted servers. Simple, low-configuration and highly customizable.
docker build -t docker-factorio .
On x86 machines:
docker run --name docker-factorio -itp 34197:34197/udp 6davids/docker-factorio
docker run --name docker-factorio -itdp 34197:34197/udp 6davids/docker-factorio # runs detached
On m1 Macs:
docker run --name docker-factorio -itp 34197:34197/udp --platform linux/amd64 6davids/docker-factorio # ctrl-c kills server
docker run --name docker-factorio -itdp 34197:34197/udp --platform linux/amd64 6davids/docker-factorio # runs detached
Interactive:
david@focus docker-factorio % # Hop into the container
david@focus docker-factorio % docker exec -it docker-factorio bash
root@docker-factorio:/app
root@docker-factorio:/app # Start Interactive Script
root@docker-factorio:/app ./interact.sh
250.157 Info ServerMultiplayerManager.cpp:943: updateTick(15117) received stateChanged peerID(1) oldState(ConnectedDownloadingMap) newState(ConnectedLoadingMap)
250.341 Info ServerMultiplayerManager.cpp:943: updateTick(15127) received stateChanged peerID(1) oldState(ConnectedLoadingMap) newState(TryingToCatchUp)
250.342 Info ServerMultiplayerManager.cpp:943: updateTick(15127) received stateChanged peerID(1) oldState(TryingToCatchUp) newState(WaitingForCommandToStartSendingTickClosures)
250.355 Info GameActionHandler.cpp:4996: UpdateTick (15127) processed PlayerJoinGame peerID(1) playerIndex(0) mode(connect)
250.407 Info ServerMultiplayerManager.cpp:943: updateTick(15131) received stateChanged peerID(1) oldState(WaitingForCommandToStartSendingTickClosures) newState(InGame)
2022-04-09 06:08:43 [JOIN] david joined the game
sup
2022-04-09 06:08:51 [CHAT] <server>: sup
2022-04-09 06:09:46 [CHAT] david: lol
/kick david lol
Non-Interactive (for scripts or one-offs):
david@focus docker-factorio % # Hop into the container
david@focus docker-factorio % docker exec -it docker-factorio bash
root@docker-factorio:/app # Send commands to the server
root@docker-factorio:/app ./run-command.sh "sup"
2022-04-09 17:03:11 [CHAT] <server>: sup
root@docker-factorio:/app ./run-command.sh "/kick david lol"
2022-04-09 17:03:24 [KICK] david was kicked by <server>. Reason: lol. 1352.490 Info ServerMultiplayerManager.cpp:1061: Disconnect notification for peer (1)
Or, if you don't need to see the command output:
david@focus docker-factorio % # Hop into the container
david@focus docker-factorio % docker exec -it docker-factorio bash
root@docker-factorio:/app # Send commands to the server
root@docker-factorio:/app echo "sup" > ./factorio-server-fifo
root@docker-factorio:/app echo "/kick david lol" > ./factorio-server-fifo
The image comes with a few scripts to help managing server execution.
root@docker-factorio:/app # Hop into the container
david@focus docker-factorio % docker exec -it docker-factorio bash
root@docker-factorio:/app # Stop the factorio server
root@docker-factorio:/app ./stop-server.sh
Stopping Factorio Server...
Done!
root@docker-factorio:/app # The server starts on it's own, but you can start it again after stopping it.
root@docker-factorio:/app ./start-server.sh
Starting Factorio Server...
Done!
root@docker-factorio:/app # Cycle the server. Useful after config changes.
root@docker-factorio:/app ./restart-server.sh
Stopping Factorio Server...
Done!
Starting Factorio Server...
Done!
By default the container creates a new game and then uses it from then on. If you'd like to use your own games, create two mounts when running the container:
/app/factorio/saves//app/factorio/last-game.txtDrop your save files in the saves/ directory, and then enter the name of the save file you'd to use into last-game.txt
Example:
david@focus docker-factorio % cp my-cool-saved-game.zip ~/factorio-stuffs/saved-games/
david@focus docker-factorio % echo "my-cool-saved-game.zip" > ~/factorio-stuffs/last-game.txt
david@focus docker-factorio % # Start the container detached, with ports mounted, and the two binds mentioned above
david@focus docker-factorio % docker run --name docker-factorio -it \
> -d
> -p 34197:34197/udp \
> --mount type=bind,source=~/factorio-stuffs/saved-games,target=/app/factorio/saves \
> --mount type=bind,source=~/factorio-stuffs/last-game.txt,target=/app/factorio/last-game.txt \
> 6davids/docker-factorio
abdac7023091
david@focus docker-factorio % # We're ready to go
Settings can be managed the same way that saved games are. Mount files in the default locations to populate the server configs.
Content type
Image
Digest
Size
132.4 MB
Last updated
over 4 years ago
docker pull 6davids/docker-factorio