mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-04 16:08:15 +02:00
Compare commits
40 Commits
Author | SHA1 | Date | |
---|---|---|---|
99969df99d | |||
223faba61f | |||
d245b75420 | |||
7b70d806ad | |||
433155549f | |||
e7afbf7043 | |||
66a931efea | |||
0df69d27ba | |||
8b76ac8c69 | |||
39569f1ea2 | |||
8042aed70f | |||
52b9a5a0a5 | |||
bad5c783d7 | |||
72798cda20 | |||
57b221d308 | |||
7dd16c1e3a | |||
7fe00ee1e1 | |||
2600a90c4e | |||
67e6e928a6 | |||
3643eebca1 | |||
012180bae6 | |||
ff2bfae329 | |||
0309a94ed9 | |||
d10a30c01f | |||
52840aff65 | |||
07b066754d | |||
c6c76b5a41 | |||
9fbd7d92bc | |||
ef731d433a | |||
35ee88bf7f | |||
fb0d9e444b | |||
b99b296865 | |||
7bedca570d | |||
9a0de68628 | |||
08a2732ee3 | |||
c8d64cc1db | |||
f096877853 | |||
bf83c650bc | |||
7205f9fb2a | |||
f9fbd2a59f |
28
0.13/Dockerfile
Normal file
28
0.13/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.4
|
||||
|
||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||
|
||||
COPY ./factorio.crt /opt/factorio.crt
|
||||
|
||||
ENV VERSION=0.13.20 \
|
||||
SHA1=59ed0edb3f62f0f41a01fc291959b0a8b44cf631
|
||||
|
||||
RUN apk --no-cache add curl tini pwgen && \
|
||||
curl -sSL --cacert /opt/factorio.crt \
|
||||
https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
|
||||
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||
apk del curl && \
|
||||
ln -s /factorio/saves /opt/factorio/saves && \
|
||||
ln -s /factorio/mods /opt/factorio/mods
|
||||
|
||||
VOLUME /factorio
|
||||
|
||||
EXPOSE 34197/udp 27015/tcp
|
||||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/docker-entrypoint.sh"]
|
1
0.13/build.sh
Executable file
1
0.13/build.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo docker build -t dtandersen/factorio:0.13-dev .
|
1
0.13/clean.sh
Executable file
1
0.13/clean.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo rm -rf /tmp/factorio
|
35
0.13/docker-entrypoint.sh
Executable file
35
0.13/docker-entrypoint.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
set -e
|
||||
|
||||
SAVES=/factorio/saves
|
||||
CONFIG=/factorio/config
|
||||
|
||||
mkdir -p $SAVES
|
||||
mkdir -p /factorio/mods
|
||||
mkdir -p $CONFIG
|
||||
|
||||
if [ ! -f $CONFIG/rconpw ]; then
|
||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
|
||||
fi
|
||||
|
||||
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||
/opt/factorio/bin/x64/factorio \
|
||||
--create $SAVES/_autosave1.zip \
|
||||
--map-gen-settings $CONFIG/map-gen-settings.json
|
||||
fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--port 34197 \
|
||||
--start-server-load-latest \
|
||||
--server-settings $CONFIG/server-settings.json \
|
||||
--rcon-port 27015 \
|
||||
--rcon-password "$(cat $CONFIG/rconpw)"
|
5
0.13/run.sh
Executable file
5
0.13/run.sh
Executable file
@ -0,0 +1,5 @@
|
||||
sudo docker run --rm -it \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
dtandersen/factorio:0.13-dev "$@"
|
||||
find /tmp/factorio -type f
|
@ -2,23 +2,19 @@ FROM frolvlad/alpine-glibc:alpine-3.4
|
||||
|
||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||
|
||||
COPY ./factorio.crt /opt/factorio.crt
|
||||
ENV VERSION=0.14.21 \
|
||||
SHA1=fc11c0d5b2671e0cf36db7907de6ff617525ede3
|
||||
|
||||
ENV VERSION=0.14.16 \
|
||||
SHA1=e27c658bf8a7579b662a1c34815daa223e57bc90
|
||||
|
||||
RUN apk --update --no-cache add bash curl && \
|
||||
curl -sSL --cacert /opt/factorio.crt \
|
||||
https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||
RUN mkdir /opt && \
|
||||
apk --no-cache add curl tini pwgen && \
|
||||
curl -sSL https://www.factorio.com/get-download/$VERSION/headless/linux64 \
|
||||
-o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
|
||||
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz --directory /opt && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||
apk --no-cache del curl && \
|
||||
apk del curl && \
|
||||
ln -s /factorio/saves /opt/factorio/saves && \
|
||||
ln -s /factorio/mods /opt/factorio/mods && \
|
||||
ln -s /factorio/config/server-settings.json /opt/factorio/data/server-settings.json && \
|
||||
ln -s /factorio/config/map-gen-settings.json /opt/factorio/data/map-gen-settings.json
|
||||
ln -s /factorio/mods /opt/factorio/mods
|
||||
|
||||
VOLUME /factorio
|
||||
|
||||
@ -26,4 +22,5 @@ EXPOSE 34197/udp 27015/tcp
|
||||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/docker-entrypoint.sh"]
|
||||
|
2
0.14/build.sh
Normal file → Executable file
2
0.14/build.sh
Normal file → Executable file
@ -1 +1 @@
|
||||
sudo docker build -t factorio .
|
||||
sudo docker build --no-cache -t factorio .
|
||||
|
1
0.14/clean.sh
Executable file
1
0.14/clean.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo rm -rf /tmp/factorio
|
29
0.14/docker-entrypoint.sh
Normal file → Executable file
29
0.14/docker-entrypoint.sh
Normal file → Executable file
@ -1,28 +1,35 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/sh -x
|
||||
|
||||
set -e
|
||||
|
||||
SAVES=/opt/factorio/saves
|
||||
SAVES=/factorio/saves
|
||||
CONFIG=/factorio/config
|
||||
|
||||
mkdir -p /factorio/saves
|
||||
mkdir -p $SAVES
|
||||
mkdir -p /factorio/mods
|
||||
mkdir -p /factorio/config
|
||||
mkdir -p $CONFIG
|
||||
|
||||
if [ ! -f /factorio/config/server-settings.json ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json /factorio/config/server-settings.json
|
||||
if [ ! -f $CONFIG/rconpw ]; then
|
||||
echo $(pwgen 15 1) > $CONFIG/rconpw
|
||||
fi
|
||||
|
||||
if [ ! -f /factorio/config/map-gen-settings.json ]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json /factorio/config/map-gen-settings.json
|
||||
if [ ! -f $CONFIG/server-settings.json ]; then
|
||||
cp /opt/factorio/data/server-settings.example.json $CONFIG/server-settings.json
|
||||
fi
|
||||
|
||||
if [ ! -f $CONFIG/map-gen-settings.json ]; then
|
||||
cp /opt/factorio/data/map-gen-settings.example.json $CONFIG/map-gen-settings.json
|
||||
fi
|
||||
|
||||
if ! find -L $SAVES -iname \*.zip -mindepth 1 -print | grep -q .; then
|
||||
/opt/factorio/bin/x64/factorio \
|
||||
--create $SAVES/save.zip \
|
||||
--map-gen-settings /opt/factorio/data/map-gen-settings.json
|
||||
--create $SAVES/_autosave1.zip \
|
||||
--map-gen-settings $CONFIG/map-gen-settings.json
|
||||
fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--port 34197 \
|
||||
--start-server-load-latest \
|
||||
--server-settings /opt/factorio/data/server-settings.json
|
||||
--server-settings $CONFIG/server-settings.json \
|
||||
--rcon-port 27015 \
|
||||
--rcon-password "$(cat $CONFIG/rconpw)"
|
||||
|
6
0.14/run.sh
Normal file → Executable file
6
0.14/run.sh
Normal file → Executable file
@ -1,9 +1,5 @@
|
||||
#mkdir -p /tmp/factorio/config
|
||||
#mkdir -p /tmp/factorio/mods
|
||||
#mkdir -p /tmp/factorio/saves
|
||||
#cp -n server-settings.example.json /tmp/factorio/config/server-settings.json
|
||||
#cp -n map-gen-settings.example.json /tmp/factorio/config/map-gen-settings.json
|
||||
sudo docker run --rm -it \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
factorio "$@"
|
||||
find /tmp/factorio -type f
|
||||
|
50
README.md
50
README.md
@ -1,7 +1,8 @@
|
||||
# Factorio [](https://hub.docker.com/r/dtandersen/factorio/) [](https://hub.docker.com/r/dtandersen/factorio/)
|
||||
|
||||
* `0.14.16`, `0.14`, `latest` [(0.14.16/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/0.14.16/Dockerfile)
|
||||
|
||||
* `0.14.21`, `0.14`, `latest` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.14/Dockerfile)
|
||||
* `0.14.20`, `stable` [(0.14/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/0.14.20/0.14/Dockerfile)
|
||||
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/Dockerfile)
|
||||
|
||||
# What is Factorio?
|
||||
|
||||
@ -21,14 +22,19 @@ 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 -v /tmp/factorio:/factorio --name factorio dtandersen/factorio
|
||||
docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
--restart=always \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
For those new to Docker, here is an explanation of the options:
|
||||
|
||||
* `-d` - Run as a daemon ("detached").
|
||||
* `-P` - Expose all ports.
|
||||
* `-p` - Expose 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:
|
||||
@ -54,9 +60,9 @@ Try to connect to the server. Check the logs if it isn't working.
|
||||
|
||||
## Saves
|
||||
|
||||
A new map named `save.zip` is generated the first time the server is started. The `map-gen-settings.json` file in `/tmp/factorio/config` is 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` file in `/tmp/factorio/config` is 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.
|
||||
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.
|
||||
|
||||
@ -66,16 +72,20 @@ To generate a new map stop the server, delete all of the saves and restart the s
|
||||
Copy mods into the mods folder and restart the server.
|
||||
|
||||
|
||||
## Remote Console
|
||||
## RCON
|
||||
|
||||
RCON is currently disabled.
|
||||
Set the RCON password in the `rconpw` 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 with `-p 34197:34197/udp` instead of `-P`. RCON still runs, but nobody is able to connect to it.
|
||||
|
||||
|
||||
# Container Details
|
||||
|
||||
The philosophy is to keep things simple.
|
||||
The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
|
||||
|
||||
* Self-configure to a minimal working state.
|
||||
* The server should bootstrap itself.
|
||||
* Prefer configuration files over environment variables.
|
||||
* Use one volume for data.
|
||||
|
||||
@ -86,13 +96,13 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
|
||||
|
||||
factorio
|
||||
|-- config
|
||||
| |-- server-settings.json
|
||||
| +-- map-gen-settings.json
|
||||
| |-- map-gen-settings.json
|
||||
| |-- rconpw
|
||||
| `-- server-settings.json
|
||||
|-- mods
|
||||
| |-- fancymod.zip
|
||||
+-- saves
|
||||
|-- _autosave1.zip
|
||||
+-- save.zip
|
||||
| `-- fancymod.zip
|
||||
`-- saves
|
||||
`-- _autosave1.zip
|
||||
|
||||
|
||||
## Ports
|
||||
@ -103,9 +113,13 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Server is listed in the in-game server browser, but users can't connect**
|
||||
**My server is listed in the server browser, but nobody can connect**
|
||||
|
||||
Run Docker with the `--userland-proxy=false` option. The source UDP port is changed by docker-proxy when the server pings "pingpong" servers. See [Incorrect port detected for docker hosted server](https://forums.factorio.com/viewtopic.php?f=49&t=35255).
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
# Credits
|
||||
|
Reference in New Issue
Block a user