-
Notifications
You must be signed in to change notification settings - Fork 85
/
README.Container
65 lines (48 loc) · 2.98 KB
/
README.Container
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
BZFlag Server Container
=======================
We provide a Dockerfile for those who wish to run BZFlag servers inside containers. Adding custom plugins or source code
changes is easy as it copies the local source code into the build container. The example commands below will use the
docker command, but should also work with the podman command.
Building the container
----------------------
Building a stock BZFlag server container:
docker build . -t bzflag-server:latest
Custom plugins placed in the plugins/ directory can be built by passing a comma separated list of directory names as a
build argument:
docker build . -t bzflag-server:latest --build-arg plugins="UselessMine,mapchange"
It is also possible to supply custom arguments to the configure script:
docker build . -t bzflag-server:latest --build-arg configure="--enable-custom-plugins-file=plugins.txt"
Troubleshooting
---------------
> [stage-1 2/5] RUN apk update && apk upgrade --no-cache && apk add --no-cache c-ares libcurl libgcc libstdc++ zlib\
&& adduser -S bzfsd && mkdir /data && chown bzfsd:nogroup /data:
> 0.393 fetch https://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz
> 5.394 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.20/main: temporary error (try again later)
If the build process fails due to network errors on the `apk update` step, then it may be a DNS problem with your Docker
engine configuration. Add the `--network=host` flag to your `docker build` command to use your host machine's DNS
instead of Docker's internal DNS.
Running a self-built image
--------------------------
Assume that the configuration, world, groupdb, etc for a given server are stored in a subdirectory of /srv/bzfs/, such
as /srv/bzfs/5154. The configuration file is at /srv/bzfs/5154/config.
Start a server that automatically starts when the system boots up (and restarts if bzfs exits or crashes):
docker run -d --restart unless-stopped -p 0.0.0.0:5154:5154/tcp -p 0.0.0.0:5154:5154/udp -v /srv/bzfs/5154:/data \
--name bzfs5154 bzflag-server:latest -conf config
Note that podman does not automatically start containers when the host system reboots. You must externally manage them
with some other method, such as a systemd unit. Podman supports the generation of unit files. Build and run the
container first. Then you need to use loginctl to enable linger so that the user unit can start without requiring you to
first log in to the user. Then you use podman to generate a systemd unit and enable it.
sudo loginctl enable-linger UsernameHere
mkdir -p ~/.config/systemd/user/
podman generate systemd --new --name bzfs5154 > ~/.config/systemd/user/bzfs5154.service
podman stop bzfs5154 && podman rm bzfs5154
systemctl --user daemon-reload
systemctl --user enable bzfs5154.service --now
List running and stopped containers:
docker ps -a
Stop a running server:
docker stop bzfs5154
Start a stopped server:
docker start bzfs5154
Remove a stopped server:
docker rm bzfs5154