mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-02 23:18:06 +02:00
Compare commits
107 Commits
Author | SHA1 | Date | |
---|---|---|---|
94f127dea9 | |||
4d43c3aabf | |||
bbacd8e67d | |||
eb0d08c3c3 | |||
dc53f6a61f | |||
92d459b14d | |||
ef55d08655 | |||
c5ae7515fe | |||
ec17a32638 | |||
15da4f79f5 | |||
68e8a5f25c | |||
b658982c93 | |||
1d3fc75d20 | |||
a4a482ee91 | |||
eafe7c08be | |||
9acfe47d16 | |||
b47b20e834 | |||
7e0718a332 | |||
ae327add0b | |||
efb5eb7afc | |||
ec1c4f9455 | |||
edf8035ae3 | |||
25b41c9f22 | |||
228339ec31 | |||
755c106b7b | |||
f1f76e9ae0 | |||
26f053451c | |||
c439634ef1 | |||
cc33c84d86 | |||
8806ca2160 | |||
83bf5c4a11 | |||
30859d57b8 | |||
3e9f74eaac | |||
14bbd68a3b | |||
d4052bc790 | |||
2fc2b7656d | |||
199f6c7f59 | |||
d614babc54 | |||
257e1751c2 | |||
e8e5047490 | |||
d089b02941 | |||
6fe77c30da | |||
a97763a0e1 | |||
602881a0d9 | |||
b56ab27e52 | |||
5edbcd9055 | |||
059a77574e | |||
c1488c61be | |||
fb0d7d955b | |||
a34b260d15 | |||
5d5cb71a90 | |||
ad9c5c37dc | |||
63a9eb14d2 | |||
76eddb14f8 | |||
24bd934d98 | |||
9c873ac907 | |||
c44a3d1faf | |||
926a377146 | |||
52bb117a2b | |||
04c4a6b577 | |||
39c27944be | |||
ba9faac10e | |||
c987fe8769 | |||
606b537b13 | |||
9473de8934 | |||
6b00a3fc32 | |||
34a99ec43e | |||
2caf5345c2 | |||
8a68a162fe | |||
96a6f66445 | |||
e5c351dd14 | |||
eedff789a5 | |||
20fcec5783 | |||
2bfa89fea1 | |||
ee99e7d469 | |||
817844352d | |||
abd518de79 | |||
98337ac18f | |||
2bd0d475eb | |||
2d9d8e17b8 | |||
48c22aa707 | |||
97feb7acb5 | |||
5ee0f8d06a | |||
7230263559 | |||
6f65ae8acc | |||
2fae0bdb22 | |||
4f10d32d7b | |||
61e3941a5a | |||
777cac4849 | |||
9a35472d8a | |||
5b3d17117f | |||
234eea09f0 | |||
c5e0b6b3b5 | |||
df19b88ba0 | |||
0a39c756a5 | |||
0cab74d578 | |||
23c26f83ae | |||
3de6931817 | |||
7a370c11e0 | |||
1a09531600 | |||
ea57f58c3b | |||
5eb71608de | |||
51398ca509 | |||
16dc9c9da2 | |||
e30bf8d656 | |||
3cd89b6870 | |||
f33bfadd47 |
@ -1,28 +0,0 @@
|
||||
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,0 @@
|
||||
sudo docker build -t dtandersen/factorio:0.13-dev .
|
@ -1 +0,0 @@
|
||||
sudo rm -rf /tmp/factorio
|
@ -1,35 +0,0 @@
|
||||
#!/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)"
|
@ -1,5 +0,0 @@
|
||||
sudo docker run --rm -it \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
dtandersen/factorio:0.13-dev "$@"
|
||||
find /tmp/factorio -type f
|
@ -1,26 +0,0 @@
|
||||
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,0 @@
|
||||
sudo docker build --no-cache -t factorio .
|
@ -1 +0,0 @@
|
||||
sudo rm -rf /tmp/factorio
|
@ -1,35 +0,0 @@
|
||||
#!/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)"
|
@ -1,5 +0,0 @@
|
||||
sudo docker run --rm -it \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
factorio "$@"
|
||||
find /tmp/factorio -type f
|
@ -1,30 +0,0 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.6
|
||||
|
||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||
|
||||
ENV PORT=34197 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=0.15.40 \
|
||||
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
|
||||
|
||||
RUN mkdir /opt && \
|
||||
apk add --update --no-cache tini pwgen && \
|
||||
apk add --update --no-cache --virtual .build-deps curl && \
|
||||
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 && \
|
||||
chmod -R ugo=rwx /opt/factorio && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||
ln -s /factorio/saves /opt/factorio/saves && \
|
||||
ln -s /factorio/mods /opt/factorio/mods && \
|
||||
apk del .build-deps
|
||||
|
||||
VOLUME /factorio
|
||||
|
||||
EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["/docker-entrypoint.sh"]
|
@ -1,8 +0,0 @@
|
||||
version: '2'
|
||||
services:
|
||||
factorio:
|
||||
build: .
|
||||
ports:
|
||||
- "34197:34197"
|
||||
volumes:
|
||||
- /tmp/factorio:/factorio
|
@ -1,43 +0,0 @@
|
||||
#!/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 [ ! -f $CONFIG/map-settings.json ]; then
|
||||
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-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 \
|
||||
--map-settings $CONFIG/map-settings.json
|
||||
fi
|
||||
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--port $PORT \
|
||||
--start-server-load-latest \
|
||||
--server-settings $CONFIG/server-settings.json \
|
||||
--server-whitelist $CONFIG/server-whitelist.json \
|
||||
--server-banlist $CONFIG/server-banlist.json \
|
||||
--rcon-port $RCON_PORT \
|
||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
||||
--server-id /factorio/config/server-id.json
|
@ -1,49 +0,0 @@
|
||||
FROM frolvlad/alpine-glibc:alpine-3.6
|
||||
|
||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||
|
||||
ARG USER=factorio
|
||||
ARG GROUP=factorio
|
||||
ARG PUID=845
|
||||
ARG PGID=845
|
||||
|
||||
ENV PORT=34197 \
|
||||
RCON_PORT=27015 \
|
||||
VERSION=0.16.1 \
|
||||
SHA1=1247cdb57b8146896f1972c60911fe45119c384b
|
||||
|
||||
VOLUME /factorio
|
||||
|
||||
RUN mkdir -p /opt && \
|
||||
apk add --update --no-cache pwgen && \
|
||||
apk add --update --no-cache --virtual .build-deps curl && \
|
||||
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 && \
|
||||
chmod -R ugo=rwx /opt/factorio && \
|
||||
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||
ln -s /factorio/saves /opt/factorio/saves && \
|
||||
ln -s /factorio/mods /opt/factorio/mods && \
|
||||
apk del .build-deps && \
|
||||
addgroup -g $PGID -S $GROUP && \
|
||||
adduser -u $PUID -G $USER -s /bin/sh -SDH $GROUP && \
|
||||
chown -R $USER:$GROUP /opt/factorio /factorio
|
||||
|
||||
EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||
|
||||
COPY ./docker-entrypoint.sh /
|
||||
|
||||
USER $USER
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["/opt/factorio/bin/x64/factorio", \
|
||||
"--port", "$PORT", \
|
||||
"--start-server-load-latest", \
|
||||
"--server-settings $CONFIG/server-settings.json", \
|
||||
"--server-whitelist $CONFIG/server-whitelist.json", \
|
||||
"--server-banlist $CONFIG/server-banlist.json", \
|
||||
"--rcon-port $RCON_PORT", \
|
||||
"--rcon-password", "$(cat $CONFIG/rconpw)", \
|
||||
"--server-id /factorio/config/server-id.json" \
|
||||
]
|
@ -1,9 +0,0 @@
|
||||
version: '2'
|
||||
services:
|
||||
factorio:
|
||||
build: .
|
||||
ports:
|
||||
- "34197:34197"
|
||||
volumes:
|
||||
- /opt/factorio:/factorio
|
||||
user: 1000:1000
|
@ -1,48 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
set -e
|
||||
|
||||
id
|
||||
|
||||
SAVES=/factorio/saves
|
||||
CONFIG=/factorio/config
|
||||
|
||||
mkdir -p $SAVES
|
||||
mkdir -p /factorio/mods
|
||||
mkdir -p $CONFIG
|
||||
|
||||
#chown -R factorio /factorio
|
||||
|
||||
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 [ ! -f $CONFIG/map-settings.json ]; then
|
||||
cp /opt/factorio/data/map-settings.example.json $CONFIG/map-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 \
|
||||
--map-settings $CONFIG/map-settings.json
|
||||
fi
|
||||
|
||||
#exec "$@"
|
||||
exec /opt/factorio/bin/x64/factorio \
|
||||
--port $PORT \
|
||||
--start-server-load-latest \
|
||||
--server-settings $CONFIG/server-settings.json \
|
||||
--server-whitelist $CONFIG/server-whitelist.json \
|
||||
--server-banlist $CONFIG/server-banlist.json \
|
||||
--rcon-port $RCON_PORT \
|
||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
||||
--server-id /factorio/config/server-id.json
|
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@ -0,0 +1,28 @@
|
||||
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.33 \
|
||||
FACTORIO_SHA1=9802b22f428eb404369d496f6d40633a64984406
|
||||
|
||||
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"]
|
||||
|
222
README.md
222
README.md
@ -1,18 +1,11 @@
|
||||
# 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/)
|
||||
# Supported tags and respective `Dockerfile` links
|
||||
|
||||
* `0.16.1`, `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)
|
||||
|
||||
*Tag descriptions*
|
||||
|
||||
* `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.
|
||||
* `0.x-dev` - whatever is in master for that version.
|
||||
* `0.12.33`, `latest` [(0.12.33/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/dt_0.12.33/Dockerfile)
|
||||
* `0.12.32` [(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)
|
||||
|
||||
[](https://imagelayers.io/?images=dtandersen/factorio:latest 'Get your own badge on imagelayers.io')
|
||||
|
||||
# What is Factorio?
|
||||
|
||||
@ -22,164 +15,137 @@ 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 at [factorio.com](https://www.factorio.com) and [Steam](http://store.steampowered.com/app/427520/).
|
||||
NOTE: This is only the server. The game is available on [Steam](http://store.steampowered.com/app/427520/).
|
||||
|
||||
# Features
|
||||
|
||||
# Usage
|
||||
* 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?
|
||||
|
||||
## Quick Start
|
||||
|
||||
Run the server to create the necessary folder structure and configuration files. For this example data is stored in `/tmp/factorio`.
|
||||
This runs factorio with default settings, and your save will be kept:
|
||||
|
||||
```
|
||||
docker run -d -p 34197:34197/udp -p 27015:27015/tcp \
|
||||
-v /tmp/factorio:/factorio \
|
||||
--name factorio \
|
||||
--restart=always \
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/saves \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
For those new to Docker, here is an explanation of the options:
|
||||
* 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.
|
||||
|
||||
* `-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).
|
||||
## Advanced usage
|
||||
|
||||
Check the logs to see what happened:
|
||||
### Without map persistence
|
||||
|
||||
This will generate a new random map with default settings.
|
||||
|
||||
```
|
||||
docker logs factorio
|
||||
docker run -d \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
Stop the server:
|
||||
### 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.
|
||||
|
||||
```
|
||||
docker stop factorio
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/saves \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
Now there's a `server-settings.json` file in the folder `/tmp/factorio/config`. Modify this to your liking and restart the server:
|
||||
### 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
|
||||
|
||||
```
|
||||
docker start factorio
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/saves \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
Try to connect to the server. Check the logs if it isn't working.
|
||||
### Autosave interval
|
||||
|
||||
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.
|
||||
|
||||
## Console
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_AUTOSAVE_INTERVAL=[NUMBER] \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
To issue console commands to the server, start the server in interactive mode with `-it`. Open the console with `docker attach` and then type commands.
|
||||
Where [NUMBER] is the number of minutes between autosaves.
|
||||
|
||||
docker run -d -it \
|
||||
--name factorio \
|
||||
dtandersen/factorio
|
||||
docker attach factorio
|
||||
### Autosave slots
|
||||
|
||||
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.
|
||||
|
||||
## Upgrading
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_AUTOSAVE_SLOTS=[NUMBER] \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
Before upgrading backup the save. It's easy to make a save in the client.
|
||||
Where [NUMBER] is the number of autosave slots.
|
||||
|
||||
Ensure `-v` was used to run the server so the save is outside of the Docker container. The `docker rm` command completely destroys the container, which includes the save if it isn't stored in an data volume.
|
||||
### Mounting mod volume
|
||||
|
||||
Delete the container and refresh the image:
|
||||
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 stop factorio
|
||||
docker rm factorio
|
||||
docker pull dtandersen/factorio
|
||||
```
|
||||
docker run -d \
|
||||
-v [PATH]:/opt/factorio/mods \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
Now run the server as before. In about a minute the new version of Factorio should be up and running, complete with saves and config!
|
||||
Where [PATH] is the path to the folder with your mods.
|
||||
|
||||
### Allowing in-game commands
|
||||
|
||||
## Saves
|
||||
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".
|
||||
|
||||
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.
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_DISSALOW_COMMANDS=false \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
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.
|
||||
### Activating no-auto-pause in the game when no one is on the server
|
||||
|
||||
To generate a new map stop the server, delete all of the saves and restart the server.
|
||||
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".
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--env FACTORIO_NO_AUTO_PAUSE=true \
|
||||
-p [PORT]:34197/udp \
|
||||
dtandersen/factorio
|
||||
```
|
||||
|
||||
## Mods
|
||||
### Logs
|
||||
|
||||
Copy mods into the mods folder and restart the server.
|
||||
Sometimes it's useful to see the logs of a running container:
|
||||
|
||||
```
|
||||
docker exec -it [CONTAINER] tail -f /opt/factorio/factorio-current.log
|
||||
```
|
||||
|
||||
## RCON
|
||||
# Credits
|
||||
|
||||
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 without `-p 27015:27015/tcp`. RCON is still running, but nobody can to connect to it.
|
||||
|
||||
|
||||
## Whitelisting (0.15.3+)
|
||||
|
||||
Create file `config/server-whitelist.json` and add the whitelisted users.
|
||||
|
||||
[
|
||||
"you",
|
||||
"friend"
|
||||
]
|
||||
|
||||
# Container Details
|
||||
|
||||
The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple).
|
||||
|
||||
* The server should bootstrap itself.
|
||||
* Prefer configuration files over environment variables.
|
||||
* Use one volume for data.
|
||||
|
||||
|
||||
## 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
|
||||
| `-- server-whitelist.json
|
||||
|-- mods
|
||||
| `-- fancymod.zip
|
||||
`-- saves
|
||||
`-- _autosave1.zip
|
||||
|
||||
|
||||
## Ports
|
||||
|
||||
* `34197/udp` - Game server (required).
|
||||
* `27015/tcp` - RCON (optional).
|
||||
|
||||
|
||||
## Environment Variables
|
||||
|
||||
* `PORT` (0.15+) - 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**
|
||||
|
||||
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.
|
||||
|
||||
**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.
|
||||
|
||||
|
||||
# Contributors
|
||||
|
||||
* [dtandersen](https://github.com/dtandersen/docker_factorio_server) - Maintainer
|
||||
* [Zopanix](https://github.com/zopanix/docker_factorio_server) - Originator
|
||||
* [Rfvgyhn](https://github.com/Rfvgyhn/docker-factorio) - Randomly generate RCON password
|
||||
* [gnomus](https://github.com/gnomus/docker_factorio_server) - White listing
|
||||
* [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Version update
|
||||
Based on [Zopanix' Factorio Server](https://github.com/zopanix/docker_factorio_server).
|
||||
|
43
smart_launch.sh
Executable file
43
smart_launch.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/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