mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-07-01 22:48:26 +02:00
Compare commits
94 Commits
Author | SHA1 | Date | |
---|---|---|---|
b99c1044ca | |||
b37af9bf93 | |||
185ee256ff | |||
6020015574 | |||
a520b87fc8 | |||
e3abfbbe9b | |||
6a135a06bc | |||
189395d5c8 | |||
4c1ea766f4 | |||
9ce9a63cfc | |||
8d16422fcb | |||
628c7a34aa | |||
eafc933ca5 | |||
0175ddbca9 | |||
d994449808 | |||
4e63b2654e | |||
abe6054b27 | |||
4fc35c3cdb | |||
081b0c244f | |||
a331033196 | |||
1e3d6d7886 | |||
2474da335e | |||
648b81edf8 | |||
25326b9073 | |||
cae2d3b226 | |||
e13768aa12 | |||
78f00b9f17 | |||
aedc8a29a4 | |||
7168f2927c | |||
7b19c3bfa5 | |||
bffa336cb2 | |||
06a76e4156 | |||
107b902191 | |||
9e4888fe8a | |||
aa5e51680f | |||
590adff3a0 | |||
c60794de39 | |||
a871fe689d | |||
739ed46afe | |||
dfa067e2e9 | |||
7113c03076 | |||
2095404c2a | |||
dff6b849f8 | |||
5c616483f6 | |||
856066ccf1 | |||
ce039016e0 | |||
6f20f17472 | |||
44a28d5c70 | |||
f9b2d6bb9f | |||
bb06a73144 | |||
3eed964b32 | |||
0eb64bc190 | |||
9834ca2842 | |||
6b2307635e | |||
6f4f179276 | |||
ebd6da4b97 | |||
8ee7c360c5 | |||
5f7f1f145c | |||
6b58cb1909 | |||
d6d039d4a6 | |||
02d2c449d3 | |||
8091c3a9f9 | |||
cb5bc74e4b | |||
1ce5c5db7e | |||
e2e7cc7798 | |||
487d345480 | |||
7a276adb3c | |||
7a5f3471d6 | |||
eac273e2d6 | |||
768eaac7b2 | |||
67a0420f06 | |||
b2248d1e8c | |||
60a124f22c | |||
76ee77b674 | |||
a6f0b66f9b | |||
596eec12b6 | |||
e30e313a55 | |||
9528901b95 | |||
16c0f35c97 | |||
623cd6ac87 | |||
ca3a66ca2f | |||
bc74c61fc0 | |||
893124cf43 | |||
92130e3b34 | |||
1194fde627 | |||
6ae4c0d569 | |||
11d8626ccd | |||
d1d5e405cb | |||
1c1e374346 | |||
046a632860 | |||
d80ae622fd | |||
07786290c4 | |||
1e5f88ffd9 | |||
672101f0f7 |
@ -3,8 +3,9 @@ FROM frolvlad/alpine-glibc:alpine-3.6
|
|||||||
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
MAINTAINER https://github.com/dtandersen/docker_factorio_server
|
||||||
|
|
||||||
ENV PORT=34197 \
|
ENV PORT=34197 \
|
||||||
VERSION=0.15.32 \
|
RCON_PORT=27015 \
|
||||||
SHA1=83a8a9487775d4136a3a95f1d99daa7b12ed3fc6
|
VERSION=0.15.40 \
|
||||||
|
SHA1=f79a975f6b8c0ee87e2fa60f7d1f7133f332c3ec
|
||||||
|
|
||||||
RUN mkdir /opt && \
|
RUN mkdir /opt && \
|
||||||
apk add --update --no-cache tini pwgen && \
|
apk add --update --no-cache tini pwgen && \
|
||||||
@ -13,6 +14,7 @@ RUN mkdir /opt && \
|
|||||||
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||||
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
|
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
|
||||||
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
|
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 && \
|
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||||
ln -s /factorio/saves /opt/factorio/saves && \
|
ln -s /factorio/saves /opt/factorio/saves && \
|
||||||
ln -s /factorio/mods /opt/factorio/mods && \
|
ln -s /factorio/mods /opt/factorio/mods && \
|
||||||
@ -20,7 +22,7 @@ RUN mkdir /opt && \
|
|||||||
|
|
||||||
VOLUME /factorio
|
VOLUME /factorio
|
||||||
|
|
||||||
EXPOSE $PORT/udp 27015/tcp
|
EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||||
|
|
||||||
COPY ./docker-entrypoint.sh /
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
@ -38,6 +38,6 @@ exec /opt/factorio/bin/x64/factorio \
|
|||||||
--server-settings $CONFIG/server-settings.json \
|
--server-settings $CONFIG/server-settings.json \
|
||||||
--server-whitelist $CONFIG/server-whitelist.json \
|
--server-whitelist $CONFIG/server-whitelist.json \
|
||||||
--server-banlist $CONFIG/server-banlist.json \
|
--server-banlist $CONFIG/server-banlist.json \
|
||||||
--rcon-port 27015 \
|
--rcon-port $RCON_PORT \
|
||||||
--rcon-password "$(cat $CONFIG/rconpw)" \
|
--rcon-password "$(cat $CONFIG/rconpw)" \
|
||||||
--server-id /factorio/config/server-id.json
|
--server-id /factorio/config/server-id.json
|
||||||
|
39
0.16/Dockerfile
Normal file
39
0.16/Dockerfile
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
FROM frolvlad/alpine-glibc:alpine-3.7
|
||||||
|
|
||||||
|
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.20 \
|
||||||
|
SHA1=cef6512e48d723556c028448e228f22ae7a68890
|
||||||
|
|
||||||
|
RUN mkdir -p /opt /factorio && \
|
||||||
|
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 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
|
||||||
|
|
||||||
|
VOLUME /factorio
|
||||||
|
|
||||||
|
EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||||
|
|
||||||
|
COPY ./docker-entrypoint.sh /
|
||||||
|
|
||||||
|
USER $USER
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
9
0.16/docker-compose.yml
Normal file
9
0.16/docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
factorio:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "34197:34197/udp"
|
||||||
|
- "27015:27015/tcp"
|
||||||
|
volumes:
|
||||||
|
- /opt/factorio:/factorio
|
47
0.16/docker-entrypoint.sh
Executable file
47
0.16/docker-entrypoint.sh
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/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 /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
|
92
README.md
92
README.md
@ -1,6 +1,7 @@
|
|||||||
# 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/)
|
# 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.15.32`, `0.15`, `latest`, `stable` [(0.15/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.15/Dockerfile)
|
* `0.16.20`, `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.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)
|
* `0.13.20`, `0.13` [(0.13/Dockerfile)](https://github.com/dtandersen/docker_factorio_server/blob/master/0.13/Dockerfile)
|
||||||
|
|
||||||
@ -28,11 +29,15 @@ NOTE: This is only the server. The game is available at [factorio.com](https://w
|
|||||||
|
|
||||||
## Quick Start
|
## 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 \
|
sudo mkdir -p /opt/factorio
|
||||||
-v /tmp/factorio:/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 \
|
--name factorio \
|
||||||
--restart=always \
|
--restart=always \
|
||||||
dtandersen/factorio
|
dtandersen/factorio
|
||||||
@ -42,10 +47,12 @@ For those new to Docker, here is an explanation of the options:
|
|||||||
|
|
||||||
* `-d` - Run as a daemon ("detached").
|
* `-d` - Run as a daemon ("detached").
|
||||||
* `-p` - Expose ports.
|
* `-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
|
* `--restart` - Restart the server if it crashes and at system start
|
||||||
* `--name` - Name the container "factorio" (otherwise it has a funny random name).
|
* `--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:
|
Check the logs to see what happened:
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -58,7 +65,7 @@ Stop the server:
|
|||||||
docker stop factorio
|
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
|
docker start factorio
|
||||||
@ -94,7 +101,7 @@ Now run the server as before. In about a minute the new version of Factorio shou
|
|||||||
|
|
||||||
## Saves
|
## 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.
|
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.
|
||||||
|
|
||||||
@ -149,6 +156,40 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
|
|||||||
`-- _autosave1.zip
|
`-- _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
|
## Ports
|
||||||
|
|
||||||
* `34197/udp` - Game server (required).
|
* `34197/udp` - Game server (required).
|
||||||
@ -158,8 +199,45 @@ To keep things simple, the container uses a single volume mounted at `/factorio`
|
|||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
* `PORT` (0.15+) - Start the server on an alterate port, .e.g. `docker run -e "PORT=34198"`.
|
* `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
|
## Troubleshooting
|
||||||
|
|
||||||
**My server is listed in the server browser, but nobody can connect**
|
**My server is listed in the server browser, but nobody can connect**
|
||||||
|
Reference in New Issue
Block a user