Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rjhartman/doctorio
Simple distroless image for running a headless Factorio server.
https://github.com/rjhartman/doctorio
docker-image factorio
Last synced: 3 days ago
JSON representation
Simple distroless image for running a headless Factorio server.
- Host: GitHub
- URL: https://github.com/rjhartman/doctorio
- Owner: rjhartman
- Created: 2024-08-26T03:14:11.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-07T02:17:34.000Z (4 months ago)
- Last Synced: 2024-11-08T10:48:30.344Z (about 1 month ago)
- Topics: docker-image, factorio
- Language: Dockerfile
- Homepage: https://hub.docker.com/repository/docker/rhartman99/doctorio
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Doctorio
Basic Docker image for running a [headless Factorio server](https://wiki.factorio.com/Multiplayer#Dedicated/Headless_server).
## Usage
The image contains the unarchived headless server at `/opt/factorio/`. To run the server, mount the neccessary files and run the `--start-server` command. For example:
```bash
docker run -v ~/factorio/saves:/opt/factorio/saves -v ~/factorio/config:/opt/factorio/config -p 34197:34197/udp rhartman99/doctorio: --start-server /opt/factorio/saves/.zip
```This assumes you have a `~/factorio` directory that looks like this:
```bash
$ tree
.
├── config
│ └── config.ini
└── saves
├── _autosave1.zip
├── _autosave2.zip
├── _autosave3.zip
├── _autosave4.zip
├── _autosave5.zip
└── main.zip3 directories, 8 files
```### Using systemd
To host this server, I use the following service file at `/etc/systemd/system/factorio.service`:
```ini
[Unit]
Description=Factorio game server
After=docker.service
Requires=docker.service[Service]
Type=simple
Restart=always
RestartSec=1
User=rhartman
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStart=/usr/bin/docker run --name %n -v /home/rhartman/factorio/saves:/opt/factorio/saves -v /home/rhartman/factorio/config:/opt/factorio/config \
-p 34197:34197/udp rhartman99/doctorio:1.1.109 --start-server /opt/factorio/saves/main.zip \
--use-server-whitelist --server-whitelist /opt/factorio/config/server-whitelist.json[Install]
WantedBy=multi-user.target
```Make sure to replace `rhartman` with whatever user you are running. Enabling this and starting the service will ensure the server restarts on crash, and starts when the machine is booted:
```
sudo systemctl enable factorio
sudo systemctl start factorio
```## Building
To build and tag a new version of the image, run the build target with a valid Factorio version number:
```
make build VERSION=1.1.109
```This would build and tag `rhartman99/doctorio:1.1.109`.
### Recipes
#### Create a save file
```bash
# Replace ~/factorio/output with the output directory you would like to create the save in.
$ docker run -v ~/factorio/output:/opt/save rhartman99/doctorio:1.1.110 --create /opt/save/save.zip
```