This Dockerfile will create an image from which you can run a dosbox container. The dosbox config file is located in the /root/.dosbox/ volume, and the /dosbox volume will be where you write your data. If you write anywhere but in those two directory (/dosbox and /root/.dosbox/) you will lose that data once you destroy the container.
There are currently 3 versions with matching docker hub tags:
- noaudio - Audio is disabled
- host-pulse - Use your host's pulseaudio
- remote - Runs headless so you can connect via VNC/RDesktop (In Progress - Probably available w/e March 31, 2017)
-
Create a folder for dosbox in your home directory:
mkdir $HOME/dosbox
-
Download the run script from here:
-
Make it executable:
chmod a+x run-*
-
Run it:
./run-noaudio
NB: If you want to bypass the dosbox startup, you can optionally pass a command to the run script, e.g. run-noaudio /bin/sh
-
Allow your xhost to connect to the docker container
xhost +local:docker
-
Choose the appropriate options:
-
Pick the image you need:
- tudorh/dosbox:noaudio - for a local X without audio
- tudorh/dosbox:hostpulse - for a local X with audio based on pulseaudio
- tudorh/dosbox:remote - for a non-local X
-
Specify a volume for dosbox
-v /path/to/dosboxapp:/dosbox
-
If you want to run on a local host's X display, you need:
--env=DISPLAY=unix$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro
-
If you want to use your local host's pulseaudio, you need:
-
To get your local user ID and group ID:
export USER_UID=$(id -u) export USER_GID=$(id -g)
-
and pass that to the image:
--env=USER_UID=$USER_UID --env=USER_GID=$USER_GID
-
And connect as that user and group id to pulseaudio:
-v /dev/shm:/dev/shm -v $HOME/.config/pulse:/home/gamer/.config/pulse:ro -v /run/user/$USER_UID/pulse:/run/pulse:ro
-
-
-
Put it all together:
export USER_UID=$(id -u) export USER_GID=$(id -g) xhost +local:docker docker run -ti \ --env=DISPLAY=unix$DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ --env=USER_UID=$USER_UID \ --env=USER_GID=$USER_GID \ -v /dev/shm:/dev/shm \ -v $HOME/.config/pulse:/home/gamer/.config/pulse:ro \ -v /run/user/$USER_UID/pulse:/run/pulse:ro \ -v $HOME/dosbox:/dosbox \ --name dosbox \ tudorh/dosbox:hostpulse
- after dosbox is launched, type
MOUNT C /dosbox
in the prompt to mount your data volume in dosbox. (you can automate this by putting the mount command at the end of dosbox's config file)
- When you are done using dosbox you should probably run
xhost -local:docker
to re-enable the access control to the X server.