@ -31,19 +23,14 @@ NOTE: This is only the server. The game is available at [factorio.com](https://w
Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/tmp/factorio`.
```
docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
-v /tmp/factorio:/factorio \
--name factorio \
--restart=always \
dtandersen/factorio
docker run -d -P -v /tmp/factorio:/factorio --name factorio dtandersen/factorio
```
For those new to Docker, here is an explanation of the options:
*`-d` - Run as a daemon ("detached").
*`-p` - Expose ports.
*`-P` - Expose all ports.
*`-v` - Mount `/tmp/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).
Check the logs to see what happened:
@ -120,24 +107,15 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
*`27015/tcp` - RCON (optional).
## Environment Variables
*`PORT` - Start the server on an alterate port, .e.g. `docker run -e "PORT=34198"`.
## Troubleshooting
**My server is listed in the server browser, but nobody can connect**
**Server is listed in the in-game server browser, but users can't connect**
Check the logs. If there is the line`Own address is RIGHT IP:WRONG PORT`, then this could be caused by the Docker proxy. If the the IP and port is correct it's probably a port forwarding or firewall issue instead.
If the logs say`Own address is RIGHT IP:WRONG PORT`, then this could be the problem.
By default, Docker routes traffic through a proxy. The proxy changes the source UDP port, so the wrong port is detected. See the forum post *[Incorrect port detected for docker hosted server](https://forums.factorio.com/viewtopic.php?f=49&t=35255)* for details.
By default, Docker routes outbound traffic through a proxy. The proxy changes the source UDP port, so the server list detects the wrong port. See [Incorrect port detected for docker hosted server](https://forums.factorio.com/viewtopic.php?f=49&t=35255).
To fix the incorrect port, start the Docker service with the `--userland-proxy=false` switch. Docker will route traffic with iptables rules instead of a proxy. Add the switch to the `DOCKER_OPTS` environment variable or `ExecStart` in the Docker systemd service definition. The specifics vary by operating system.
**When I run a server on a port besides 34197 nobody can connect from the server browser**
Use the `PORT` environment variable to start the server on the a different port, .e.g. `docker run -e "PORT=34198"`. This changes the source port on the packets used for port detection. `-p 34198:34197` works fine for private servers, but the server browser detects the wrong port.
To fix this port problem, start the Docker service with the `--userland-proxy=false` switch. This tells Docker to use iptables rules instead of a proxy. Add the switch to the `DOCKER_OPTS` variable or `ExecStart` in the Docker systemd service definition. The location of these files varies by OS.
# Credits
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.