DOSBox in a minimal alpine linux container
5.2K
This project is Dosbox in an Alpine Linux container, complete with sound support. It was largely inspired by https://github.com/h6w/dosbox-docker and includes a handful of improvements over that project:
In order to use, you'll need to provide X11 and Pulse audio support to the container.
Audio for Linux is currently untested; I'm not sure if the asound.conf supplied to the container will negate the ability to use /dev/snd.
$ docker run \
-e DISPLAY=unix$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--device /dev/snd
classiccontainers/dosbox
After installing Docker for Windows,
config.pa, set auth-ip-acl to the Docker bridge network
(or full private subnet 172.16.0.0/12);
see Pulse Audio Docs for examples.172.16.0.0/12$ docker run \
-e DISPLAY=host.docker.internal:0 \
-e PULSE_SERVER=host.docker.internal \
classiccontainers/dosbox
At startup, DOSBox is configured to mount the A drive to /var/games/dosbox. If you would like to retain game data between container runs, simply mount a local directory to /var/games/dosbox inside the container.
$ docker run \
-v /home/user1/savedata:/var/games/dosbox \
classiccontainers/dosbox
Anything you or the game saves to the A drive should then be available on your local machine, and you should be able to load data from the same location on future runs of the container.
I was originally going to use the D drive for the save mount, but I imagine some things out there expect the D drive to be a CD-ROM, and people probably more commonly used the floppy drive at A for transferring saves (and other random stuff) anyway. Hopefully your downstream game/whatever won't barf when it sees a large drive or files on the A drive.
This image comes with a canned dosbox.conf which is loaded via the ENTRYPOINT when the container runs; included in the file are autoexec commands to mount the C drive to /home/dosbox and the A drive to /var/games/dosbox (as above).
Since the A and C drives are already in use, you'll need to put elsewhere any image mounts (for floppy or CD-ROM images) you need. See documentation on MOUNT
DOSBox will automatically load a ~/.dosbox/dosbox-{version}.conf file or
a ./dosbox.conf file if found. In an attempt to be future-proof about DOSBox
version, this image uses ./dosbox.conf, but explicitly loads it with the
-conf parameter.
It's not well documented,
but DOSBox supports
multiple -conf directives, which is why this image explicitly loads
./dosbox.conf. For regular settings, the one found in the last conf file
wins, and autoexec directives are merged.
This means that you should be able to construct a downstream image, ADD
or COPY your own conf file, and use CMD to add additional -conf filename
directives are required.
NOTE Remember to chown (or chmod) the file so that the dosbox user can read it!
Example dosbox conf:
[autoexec]
c:
mygame.exe
Example Dockerfile:
FROM classiccontainers/dosbox
# fetch game zip
ADD --chown=dosbox:dosbox https://oldgame.net/oldgame.zip oldgame.zip
RUN unzip mygame.zip
COPY --chown=dosbox:dosbox dosbox_oldgame.conf dosbox_oldgame.conf
CMD ["-conf", "dosbox_oldgame.conf"]
This project is intended for educational purposes only.
Content type
Image
Digest
Size
12.7 MB
Last updated
almost 5 years ago
docker pull classiccontainers/dosbox