|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
# Factorio [](https://microbadger.com/images/dtandersen/factorio "Get your own image badge on microbadger.com") [](https://hub.docker.com/r/dtandersen/factorio/) [](https://hub.docker.com/r/dtandersen/factorio/)
|
|
|
|
|
|
|
|
|
|
* `0.16.1`, `0.16`, `latest` [(0.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/Dockerfile)
|
|
|
|
|
* `0.16.19`, `0.16`, `latest` [(0.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/Dockerfile)
|
|
|
|
|
* `0.15.40`, `0.15`, `stable` [(0.15/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.15/Dockerfile)
|
|
|
|
|
* `0.14.23`, `0.14` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)
|
|
|
|
|
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/Dockerfile)
|
|
|
|
@ -29,11 +29,15 @@ NOTE: This is only the server. The game is available at [factorio.com](https://w
|
|
|
|
|
|
|
|
|
|
## Quick Start
|
|
|
|
|
|
|
|
|
|
Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/tmp/factorio`.
|
|
|
|
|
Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/opt/factorio`.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
|
|
|
|
|
-v /tmp/factorio:/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=always \
|
|
|
|
|
dtandersen/factorio
|
|
|
|
@ -43,10 +47,12 @@ For those new to Docker, here is an explanation of the options:
|
|
|
|
|
|
|
|
|
|
* `-d` - Run as a daemon ("detached").
|
|
|
|
|
* `-p` - Expose ports.
|
|
|
|
|
* `-v` - Mount `/tmp/factorio` on the local file system to `/factorio` in the container.
|
|
|
|
|
* `-v` - Mount `/opt/factorio` on the local file system to `/factorio` in 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:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
@ -59,7 +65,7 @@ Stop the server:
|
|
|
|
|
docker stop factorio
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Now there's a `server-settings.json` file in the folder `/tmp/factorio/config`. Modify this to your liking and restart the server:
|
|
|
|
|
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 factorio
|
|
|
|
@ -95,7 +101,7 @@ Now run the server as before. In about a minute the new version of Factorio shou
|
|
|
|
|
|
|
|
|
|
## Saves
|
|
|
|
|
|
|
|
|
|
A new map named `_autosave1.zip` is generated the first time the server is started. The `map-gen-settings.json` and `map-settings.json` files in `/tmp/factorio/config` are used for the map settings. On subsequent runs the newest save is used.
|
|
|
|
|
A new map named `_autosave1.zip` 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.
|
|
|
|
|
|
|
|
|
@ -150,6 +156,40 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
|
|
|
|
|
`-- _autosave1.zip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Docker Compose
|
|
|
|
|
|
|
|
|
|
[Docker Compose](https://docs.docker.com/compose/install/) is an easy way to run Docker containers.
|
|
|
|
|
|
|
|
|
|
First get a [docker-compose.yml](https://github.com/dtandersen/docker_factorio_server/blob/master/0.16/docker-compose.yml) file. To get it from this repository:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git clone https://github.com/dtandersen/docker_factorio_server.git
|
|
|
|
|
cd docker_factorio_server/0.16
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Or make your own:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
version: '2'
|
|
|
|
|
services:
|
|
|
|
|
factorio:
|
|
|
|
|
image: dtandersen/factorio
|
|
|
|
|
ports:
|
|
|
|
|
- "34197:34197/udp"
|
|
|
|
|
- "27015:27015/tcp"
|
|
|
|
|
volumes:
|
|
|
|
|
- /opt/factorio:/factorio
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Now cd to the directory with docker-compose.yml and run:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
sudo mkdir -p /opt/factorio
|
|
|
|
|
sudo chown 845:845 /opt/factorio
|
|
|
|
|
sudo docker-compose up -d
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Ports
|
|
|
|
|
|
|
|
|
|
* `34197/udp` - Game server (required).
|
|
|
|
@ -159,8 +199,45 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
|
|
|
|
|
## Environment Variables
|
|
|
|
|
|
|
|
|
|
* `PORT` (0.15+) - Start the server on an alterate port, .e.g. `docker run -e "PORT=34198"`.
|
|
|
|
|
* `RCON_PORT` (0.16+) - Start the RCON on an alterate port, .e.g. `docker run -e "RCON_PORT=34198"`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## LAN Games
|
|
|
|
|
|
|
|
|
|
Ensure the `lan` 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=always \
|
|
|
|
|
dtandersen/factorio
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
VirtualBox users must enable Bridged networking in order for the host to be assigned an internal network IP. Enable Bridged networking in Vagrant with:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
config.vm.network "public_network"
|
|
|
|
|
config.vm.network "forwarded_port", guest: 34197, host: 34197
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Vagrant
|
|
|
|
|
|
|
|
|
|
Vagrant is a good way for those without a Linux machine to try Docker. Check out the [Factorio Vagrant Box](https://github.com/dtandersen/factorio-lan-vagrant).
|
|
|
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
|
|
**My server is listed in the server browser, but nobody can connect**
|
|
|
|
|