DOS in Docker with SSH

Access DOS prompt in Docker Container using DosEmu and SSH

Posted by J├╝rgen on 18 October 2022

What? Why?

Well perhaps first a bit of background information; For the past 20 years or so, I've been using Star Commander in MS-DOS to manipulate .D64 files for use with Commodore 64 Emulators. I used to transfer disks to image files over a X1541 cable using Star Commander, and change the contents of these images, either to clean up or group programs.

I still use these Emulators, but I don't really have any machines left that can run DOS (Though DosBox is great). But since I have special hardware to transfer D64 images to and from actual C64 machines, I only use DOS for D64 manipulation; transfer PRG files to and from these disk images. Even though I can run DosBox on my laptop to emulate DOS, I thought it would be a nice experiment to try and get a DOS prompt over SSH working. So the result might not be anything useful to anybody, but I found it to be a fun little project.


This setup will use the following software:

  • Docker
  • DosEmu

I've created the following Dockerfile

FROM ubuntu:bionic

RUN apt update 
RUN apt upgrade -y
RUN apt install -y --no-install-recommends dosemu openssh-server
RUN echo '$_layout = "us"' >> /etc/dosemu/dosemu.conf
RUN mkdir -p /var/run/sshd

RUN useradd -m -s /bin/bash c64
RUN echo c64:pass123 | chpasswd
COPY profile /home/c64/.bashrc
RUN mkdir -p /home/c64/.dosemu/drive_c
RUN chown -Rf c64 /home/c64

CMD ["/usr/sbin/sshd", "-D"]

with a file called profile containing stuff to set the terminal to 80x25 and start DosEmu, and clean up a bit after exiting DosEmu.

stty cols 80 rows 25

Build the image named dos with

docker build . -t dos

And start it using

docker run -p 2222:22 -v ./dos:/home/c64/.dosemu/drive_c dos

Now when connecting with ssh to localhost:2222 as user c64 with password pass123 we are greeted with a familiar DOS prompt. And when you're done, type exitemu. When you have specific DOS software you want to run, place it in the ~/.dos folder, which will then appear on your C: drive.

That's it.

DOS Prompt

DOS Star Commander