Running BZFS in Docker

Place for people to discuss public servers, and also for admins to lay out the details of their servers
Post Reply
User avatar
Private First Class
Private First Class
Posts: 252
Joined: Sun Nov 18, 2018 7:25 pm
Location: zone of the phantoms

Running BZFS in Docker

Post by tainn »

This thread encompasses running of bzfs (bzflag servers) inside docker containers. It assumes the reader has little to no prior knowledge surrounding the subject and explains the process of usage in as much practical and as least theoretical terms as possible. It can be seen as a brutally elementary quick start to the containerized bzfs running approach.

Since the base file for configs is docker-compose.yml, docker-compose is required alongside docker.

The image (tainnted/bzfs) is available on docker hub. It is automatically fetched from the remote repository when not found locally the first time of running docker-compose. Every subsequent run finds it locally and initiates no pulls, unless explicitly requested otherwise.

The image itself uses fedora linux as the base image and layer in its first release.

The following is an example docker-compose.yml file, featuring the barebone requirements for running bzfs; file also attached to this post. Each service is effectively a separate container. This specific example sets up three maps: gloom, apotheosis, pitch.

Code: Select all

version: '3'

  image: tainnted/bzfs
  restart: always
    - './:/bz:z'

    <<: *inherit
      - "9000:5154/udp"
      - "9000:5154/tcp"
    working_dir: /bz/gloom
    command: gloom.conf -d
    <<: *inherit
      - "9001:5154/udp"
      - "9001:5154/tcp"
    working_dir: /bz/apotheosis
    command: apotheosis.conf -d

    <<: *inherit
      - "9002:5154/udp"
      - "9002:5154/tcp"
    working_dir: /bz/pitch
    command: pitch.conf -d
All paths are relative to the location of the docker-compose.yml file on the filesystem. In my case, the docker-compose.yml file is located in the root directory of everything bz-related. Running multiple services in the same docker-compose.yml puts them all on the same network by default.

  • image: the base image, fetched from docker hub if not found locally
  • restart: automatically respawns the container upon non-manual stop
  • volume: maps the contents of the current directory to /bz inside the container
  • ports: outer:inner port mappings
  • working_dir: effective cd for the remainder of the compose file
  • command: addition to the bzfs -conf entrypoint included in the image
Minimal required changes
  • services - it is recommended to name them similarly to maps/servers they represent
  • outer ports - whichever you expose
  • working_dir - relative path to the dir with the conf file
  • command - name of the conf file with potential further options
Once configured, running these services/containers is as simple as:

Code: Select all

docker-compose up -d
Your containers are up and running! If you'll want to put the containers down, however, the command is as follows:

Code: Select all

docker-compose down
This will stop and remove the running containers. You can lift them up again via the up command at any point. Have fun on your containerized journey!
(353 Bytes) Downloaded 13 times
Post Reply