mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-04 16:08:15 +02:00
Compare commits
207 Commits
Author | SHA1 | Date | |
---|---|---|---|
4872cf89f6 | |||
99c0355d12 | |||
7b351c473a | |||
b839d7d339 | |||
40974755b6 | |||
548f9b27d0 | |||
be99942271 | |||
f19f731662 | |||
eea4c90fa5 | |||
ce161daf33 | |||
a3d7c55f68 | |||
736dbea3b3 | |||
aeb549b3b5 | |||
2906b59721 | |||
abdce572de | |||
ca7fc9ff13 | |||
ebcca5251c | |||
b72b906fdb | |||
b643a13e88 | |||
6499b0974e | |||
c9052c3296 | |||
832e64511d | |||
a3890f37fa | |||
4089f8d59a | |||
4026ec5359 | |||
9e93a34d6e | |||
05d697afac | |||
d9a5604448 | |||
128e15db7c | |||
71e9179722 | |||
e3a97f3448 | |||
5506d33475 | |||
0314266309 | |||
16a85d32e9 | |||
d36578a471 | |||
9f8453645a | |||
eb4814f16c | |||
c85ce5e75a | |||
d4a5f0f019 | |||
8222bd1b45 | |||
de26a241af | |||
ea4843498b | |||
009548446f | |||
a48b23201b | |||
e9962a431b | |||
2f41a0d660 | |||
53c953707b | |||
b53d98cb2a | |||
833de3cc46 | |||
d94543bbcd | |||
7074d5284b | |||
c119b077c8 | |||
479d7e2fe1 | |||
1247c62b13 | |||
a7f765a070 | |||
1c8b9fd5b9 | |||
1ddcbec2c5 | |||
2d82e0a19c | |||
6320dd04df | |||
1ea5ddfbee | |||
067ac0ac14 | |||
036a15ce1e | |||
003f0cdbe6 | |||
43fafdcfe5 | |||
667bd97388 | |||
62da6f5f56 | |||
47ca759742 | |||
e12e303d2d | |||
ebf0afa524 | |||
1b5a9d5b9e | |||
3404976818 | |||
ba68274a7b | |||
ee509835db | |||
ee3385959d | |||
0ac68ac31a | |||
552520136d | |||
2b63d0ef0e | |||
390c76906b | |||
5bc0e128f1 | |||
0fdac9cebb | |||
86ec899b06 | |||
81edeb0183 | |||
08090e70a0 | |||
16602ba40b | |||
16b6a5b253 | |||
44f5ffd6b4 | |||
8fd01ef07f | |||
6b8c0f01ab | |||
284e7f00b0 | |||
abe0c82a8e | |||
f90f3c7569 | |||
9dca3590ae | |||
1e7c8bc8b7 | |||
4ed57b0c20 | |||
88258a263e | |||
f3df464856 | |||
3a007b377f | |||
ddf7f99a2b | |||
8a3df67b52 | |||
14b11329d7 | |||
2d79854697 | |||
65658b10d6 | |||
be4c89d937 | |||
cb52eb3dff | |||
322fe61b13 | |||
3e42118a04 | |||
ee861acee5 | |||
f69732d4f8 | |||
86914046e0 | |||
f7c2b144ce | |||
a2179f3f61 | |||
3cc553c786 | |||
0b3a7bd84c | |||
a28d8315aa | |||
14d1af4d9e | |||
b8c0e42baa | |||
148c01eab0 | |||
99c79f7e64 | |||
11f92f34d8 | |||
186af111d9 | |||
b6f14800ab | |||
4a5504cdb6 | |||
0e8cb6c26c | |||
b950fe99c6 | |||
6ed85052ff | |||
30425c8d66 | |||
522a3a2e93 | |||
e37cdcc508 | |||
7babfe47ff | |||
bfd2c5f600 | |||
3fc2e97f7e | |||
d141764f44 | |||
4a816ad5f9 | |||
d1aa470d25 | |||
70e936c7e3 | |||
f17e773885 | |||
c8af86eaef | |||
dcac7d0c46 | |||
b6d1748deb | |||
e1e8ff07e6 | |||
601ee80a47 | |||
fd4ed925b2 | |||
2d1f625219 | |||
7d5e58d4a0 | |||
c535246dac | |||
16959ea374 | |||
8f6446f088 | |||
65a32b3cbf | |||
7ca5892e5e | |||
327fd1c925 | |||
323718b631 | |||
8049134ed5 | |||
0a35d754ec | |||
cf60f77d53 | |||
65315ccfa8 | |||
e7ac99c855 | |||
7798e07daf | |||
993ca2631c | |||
a0551876fa | |||
74a32021de | |||
545297c443 | |||
a9fc7f32d9 | |||
fd2f656e57 | |||
d99ff47bbc | |||
b056148d75 | |||
dfb8b32a10 | |||
78c79d8fe9 | |||
aa587d172c | |||
a4f5d9a10a | |||
09be8bf68a | |||
f589953648 | |||
46d525bcf7 | |||
115dc3b1a9 | |||
310cb82749 | |||
308f7cad10 | |||
9044045dac | |||
a1e701df66 | |||
87141b2835 | |||
a6476af82f | |||
12ec73be53 | |||
ef4c0132d4 | |||
764b214723 | |||
dcd07982a8 | |||
7880bd9f65 | |||
27fc3b97bc | |||
ce1320100b | |||
3ea1619384 | |||
52bd19356f | |||
bc55163f5c | |||
5a4e0d8ebf | |||
361bb94857 | |||
048d12ef75 | |||
4d8c94a6c8 | |||
fa1af6c03d | |||
d8b20e5531 | |||
bdb51f5020 | |||
87d1c4b0a3 | |||
89ef301d3d | |||
0960c7c371 | |||
cc496ccaa0 | |||
f9e62fe90d | |||
94494299ee | |||
677dc983e8 | |||
8588fdd6fd | |||
eb22619e44 | |||
6f33dd8444 | |||
43af3aaf33 |
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
|
26
0.14/Dockerfile
Normal file
26
0.14/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.4
|
||||
|
||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||
|
||||
ENV VERSION=0.14.23 \
|
||||
SHA1=6ef84341c6fc1cf45cfdd6acc8468aaa117b9e8a
|
||||
|
||||
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 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.14/build.sh
Executable file
1
0.14/build.sh
Executable file
@ -0,0 +1 @@
|
||||
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
|
35
0.14/docker-entrypoint.sh
Executable file
35
0.14/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.14/run.sh
Executable file
5
0.14/run.sh
Executable file
@ -0,0 +1,5 @@
|
||||
sudo docker run --rm -it \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
factorio "$@"
|
||||
find /tmp/factorio -type f
|
27
0.15/Dockerfile
Normal file
27
0.15/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.5
|
||||
|
||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||
|
||||
ENV PORT=34197 \
|
||||
VERSION=0.15.0 \
|
||||
SHA1=e7681725203afeb0645371c695989129076e51bc
|
||||
|
||||
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.xz && \
|
||||
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
|
||||
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||
apk del curl && \
|
||||
ln -s /factorio/saves /opt/factorio/saves && \
|
||||
ln -s /factorio/mods /opt/factorio/mods
|
||||
|
||||
VOLUME /factorio
|
||||
|
||||
EXPOSE $PORT/udp 27015/tcp
|
||||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/docker-entrypoint.sh"]
|
1
0.15/build.sh
Executable file
1
0.15/build.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo docker build --no-cache -t factorio .
|
1
0.15/clean.sh
Executable file
1
0.15/clean.sh
Executable file
@ -0,0 +1 @@
|
||||
sudo rm -rf /tmp/factorio
|
35
0.15/docker-entrypoint.sh
Executable file
35
0.15/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 $PORT \
|
||||
--start-server-load-latest \
|
||||
--server-settings $CONFIG/server-settings.json \
|
||||
--rcon-port 27015 \
|
||||
--rcon-password "$(cat $CONFIG/rconpw)"
|
5
0.15/run.sh
Executable file
5
0.15/run.sh
Executable file
@ -0,0 +1,5 @@
|
||||
sudo docker run --rm -it \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
factorio "$@"
|
||||
find /tmp/factorio -type f
|
28
Dockerfile
28
Dockerfile
@ -1,28 +0,0 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.3_glibc-2.23
|
||||
|
||||
MAINTAINER zopanix <zopanix@gmail.com>
|
||||
|
||||
WORKDIR /opt
|
||||
|
||||
COPY ./smart_launch.sh /opt
|
||||
COPY ./factorio.crt /opt
|
||||
|
||||
VOLUME /opt/factorio/saves /opt/factorio/mods
|
||||
|
||||
ENV FACTORIO_AUTOSAVE_INTERVAL=2 \
|
||||
FACTORIO_AUTOSAVE_SLOTS=3 \
|
||||
FACTORIO_DISSALOW_COMMANDS=true \
|
||||
FACTORIO_NO_AUTO_PAUSE=false \
|
||||
VERSION=0.12.32 \
|
||||
FACTORIO_SHA1=ce3ebfd819ae335f71f1ac68dbd6b1962bbd1df0
|
||||
|
||||
RUN apk --update add bash curl && \
|
||||
curl -sSL --cacert /opt/factorio.crt https://www.factorio.com/get-download/$VERSION/headless/linux64 -o /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||
echo "$FACTORIO_SHA1 /tmp/factorio_headless_x64_$VERSION.tar.gz" | sha1sum -c && \
|
||||
tar xzf /tmp/factorio_headless_x64_$VERSION.tar.gz && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.gz
|
||||
|
||||
EXPOSE 34197/udp
|
||||
|
||||
CMD ["./smart_launch.sh"]
|
||||
|
171
README.md
171
README.md
@ -1,10 +1,15 @@
|
||||
# Supported tags and respective `Dockerfile` links
|
||||
# Factorio [](https://hub.docker.com/r/dtandersen/factorio/) [](https://hub.docker.com/r/dtandersen/factorio/)
|
||||
|
||||
* `0.12.32`, `latest` [(0.12.32/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/dt_0.12.32/Dockerfile)
|
||||
* `0.12.31` [(0.12.31/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/dt_0.12.31/Dockerfile)
|
||||
* `0.12.30` [(0.12.30/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/dt_0.12.30/Dockerfile)
|
||||
* `0.15.0`, `0.15`, `latest` [(0.15/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.15/Dockerfile)
|
||||
* `0.14.23`, `0.14`, `stable` [(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)
|
||||
|
||||
[](https://imagelayers.io/?images=dtandersen/factorio:latest 'Get your own badge on imagelayers.io')
|
||||
*Tag philosophy*
|
||||
|
||||
* `latest` - highest version: may be experimental.
|
||||
* `stable` - highest version declared stable.
|
||||
* `0.x` - highest version in a branch: may be experimental.
|
||||
* `0.x.y` - a specific version.
|
||||
|
||||
# What is Factorio?
|
||||
|
||||
@ -14,137 +19,119 @@ You will be mining resources, researching technologies, building infrastructure,
|
||||
|
||||
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 game is available on [Steam](http://store.steampowered.com/app/427520/).
|
||||
NOTE: This is only the server. The game is available at [factorio.com](https://www.factorio.com) and [Steam](http://store.steampowered.com/app/427520/).
|
||||
|
||||
# Features
|
||||
|
||||
* Automatically takes latest save or autosave when restarting the container.
|
||||
* Volumes for saves and mods
|
||||
* Set autosave interval and number of saves.
|
||||
* Enable/disable the no-auto-pause option.
|
||||
* Enable/disable console commands in game.
|
||||
* Based on Alpine Linux.
|
||||
|
||||
# How to use this image?
|
||||
# Usage
|
||||
|
||||
## Quick Start
|
||||
|
||||
This runs factorio with default settings, and your save will be kept:
|
||||
Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/tmp/factorio`.
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/saves \
|
||||
-p [PORT]:34197/udp \
|
||||
docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
--restart=always \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
* Where [PATH] is a folder where you'll put your saves, if there already is a save in it with the string "save", that one will be taken by default, otherwize, a new one will be made.
|
||||
* Where [PORT] is the port number you choose, if you're going to launch it on your local machine, don't use the port 34197, take another one at random.
|
||||
For those new to Docker, here is an explanation of the options:
|
||||
|
||||
## Advanced usage
|
||||
* `-d` - Run as a daemon ("detached").
|
||||
* `-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).
|
||||
|
||||
### Without map persistence
|
||||
|
||||
This will generate a new random map with default settings.
|
||||
Check the logs to see what happened:
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
docker logs factorio
|
||||
```
|
||||
|
||||
### With map persistence
|
||||
|
||||
This will generate a new random map with default settings and save it onto the volume.
|
||||
Replace [PATH] with a path to a folder on the host where the map will be saved.
|
||||
Stop the server:
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/saves \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
docker stop factorio
|
||||
```
|
||||
|
||||
### With existing map
|
||||
|
||||
It's the same as above, it takes the last modified file which contains the word save in the filename as current save when booting the server. This allows when upgrading the container to take the last save, you don't have to rename the last autosave as save.zip
|
||||
Now there's a `server-settings.json` file in the folder `/tmp/factorio/config`. Modify this to your liking and restart the server:
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/saves \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
docker start factorio
|
||||
```
|
||||
|
||||
### Autosave interval
|
||||
Try to connect to the server. Check the logs if it isn't working.
|
||||
|
||||
You can set the autosave interval. By default it is set at 2 minutes bud you can change it by launching the container with the `FACTORIO_AUTOSAVE_INTERVAL` variable to whatever suits you best.
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_AUTOSAVE_INTERVAL=[NUMBER] \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
## Saves
|
||||
|
||||
Where [NUMBER] is the number of minutes between autosaves.
|
||||
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.
|
||||
|
||||
### Autosave slots
|
||||
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.
|
||||
|
||||
You can set the number of autosave slots. By default it is set at 3 slots bud you can change it by launching the container with the `FACTORIO_AUTOSAVE_SLOTS` variable to whatever suits you best.
|
||||
To generate a new map stop the server, delete all of the saves and restart the server.
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_AUTOSAVE_SLOTS=[NUMBER] \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
Where [NUMBER] is the number of autosave slots.
|
||||
## Mods
|
||||
|
||||
### Mounting mod volume
|
||||
Copy mods into the mods folder and restart the server.
|
||||
|
||||
As everybody knows about factorio is you can add mods to it. Now you can also do it in this docker image by mounting a volume.
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/mods \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
## RCON
|
||||
|
||||
Where [PATH] is the path to the folder with your mods.
|
||||
Set the RCON password in the `rconpw` file. A random password is generated if `rconpw` doesn't exist.
|
||||
|
||||
### Allowing in-game commands
|
||||
To change the password stop the server, modify `rconpw`, and restart the server.
|
||||
|
||||
I've always disabled in-game commands because I think it is like cheating, however, you can enable them by setting the the `FACTORIO_DISSALOW_COMMANDS` variable to "false".
|
||||
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.
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_DISSALOW_COMMANDS=false \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
### Activating no-auto-pause in the game when no one is on the server
|
||||
# Container Details
|
||||
|
||||
I do not recommend this feature, bud it can make the game more difficult if you're up for a challenge :-). Just set the `FACTORIO_NO_AUTO_PAUSE` variable to "true".
|
||||
The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_NO_AUTO_PAUSE=true \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
* The server should bootstrap itself.
|
||||
* Prefer configuration files over environment variables.
|
||||
* Use one volume for data.
|
||||
|
||||
### Logs
|
||||
|
||||
Sometimes it's useful to see the logs of a running container:
|
||||
## Volumes
|
||||
|
||||
To keep things simple, the container uses a single volume mounted at `/factorio`. This volume stores configuration, mods, and saves.
|
||||
|
||||
factorio
|
||||
|-- config
|
||||
| |-- map-gen-settings.json
|
||||
| |-- rconpw
|
||||
| `-- server-settings.json
|
||||
|-- mods
|
||||
| `-- fancymod.zip
|
||||
`-- saves
|
||||
`-- _autosave1.zip
|
||||
|
||||
|
||||
## Ports
|
||||
|
||||
* `34197/udp` - Factorio clients (required).
|
||||
* `27015/tcp` - RCON (optional).
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**My server is listed in the server browser, but nobody can 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.
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
docker exec -it [CONTAINER] tail -f /opt/factorio/factorio-current.log
|
||||
```
|
||||
|
||||
# Credits
|
||||
|
||||
Based on [Zopanix' Factorio Server](https://github.com/zopanix/docker_factorio_server).
|
||||
Ideas borrowed from:
|
||||
|
||||
* [Zopanix](https://github.com/zopanix/docker_factorio_server)
|
||||
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio)
|
||||
|
@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f /opt/factorio/saves/save.zip ]
|
||||
then
|
||||
echo "###"
|
||||
echo "# Using existing map [save.zip]"
|
||||
echo "###"
|
||||
echo "###"
|
||||
echo "# Finding latest map"
|
||||
echo "###"
|
||||
last_save=$(ls /opt/factorio/saves -lt | grep save |head -1 |awk '{print $(NF)}')
|
||||
else
|
||||
echo "###"
|
||||
echo "# Creating a new map [save.zip]"
|
||||
echo "###"
|
||||
/opt/factorio/bin/x64/factorio --create save.zip
|
||||
last_save="save.zip"
|
||||
echo "###"
|
||||
echo "# New map created [save.zip]"
|
||||
echo "###"
|
||||
fi
|
||||
|
||||
# Checking options
|
||||
if [ "$FACTORIO_DISSALOW_COMMANDS" == false ]; then
|
||||
disallow_commands=""
|
||||
else
|
||||
disallow_commands="--disallow-commands"
|
||||
fi
|
||||
if [ "$FACTORIO_NO_AUTO_PAUSE" == true ]; then
|
||||
no_auto_pause="--no-auto-pause"
|
||||
else
|
||||
no_auto_pause=""
|
||||
fi
|
||||
echo "###"
|
||||
echo "# Launching Game"
|
||||
echo "###"
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
$disallow_commands \
|
||||
$no_auto_pause \
|
||||
--autosave-interval ${FACTORIO_AUTOSAVE_INTERVAL} \
|
||||
--autosave-slots ${FACTORIO_AUTOSAVE_SLOTS} \
|
||||
--start-server \
|
||||
$last_save
|
Reference in New Issue
Block a user