Author Topic: Docker image which can build both 16 and 32-bit MS-DOS apps  (Read 5032 times)


  • Full Member
  • ***
  • Posts: 113
Docker image which can build both 16 and 32-bit MS-DOS apps
« on: March 31, 2020, 03:13:30 am »
I thought this would be the best sub-forum to post this under...

Do you need a consistent easy to grab development environment to build both 16-bit real-mode and 32-bit protected mode ObjectPascal programs in?  Well, I have the solution for you!  If you have access to Docker, either in a VM on Windows/Mac, or natively on your Linux workstation, you can either build my Dockerfile yourself with your own customization and FPC version, or pull a ready made FPC 3.2.0 RC1 Docker image I slapped together today!

I have tested both the i8086 and GO32v2 FPC targets in this Docker image and can confirm they run in DOS as expected.  This is a beta version of the next FPC release, so be warned that there might be some bugs and such, but this could be your chance to try compiling your current 16-bit and 32-bit programs on the latest and greatest FPC version to see if they run as expected and of course open bug reports if you notice anything off.

Dockerfile in my GitHub repo:

Docker image in Docker Hub:

Command you can run right now(if you have Docker installed):

Code: Bash  [Select][+][-]
  1. $ docker run -it --rm -v `pwd`:/usr/src kveroneau/fpc:3.2.0

This will make your current working directory available under /usr/src in the Docker container when it runs, so run this command in a directory where you have some source code you'd like to try and compile against FPC 3.2.0.

Here is how you can build for each target:

Code: GNU make  [Select][+][-]
  1. all: hello.exe hello32.exe
  3. hello.pas
  4.         ppcross8086 -o$@ -WmTiny -Wtcom $<
  6. hello.exe: hello.pas
  7.         ppcross8086 -o$@ -WmTiny -Wtexe $<
  9. hello32.exe: hello.pas
  10.         ppcross386 -o$@ -Tgo32v2 $<
  12. clean:
  13.         rm -rf *.com *.exe *.a *.o

If you used the docker command-line provided above, your host operating system should now contain a couple .EXE files and a .COM file within the same source directory you shared with the Docker container.  Easy stuff.

What is even cooler about this, is that you can create a nice shell script to run a Makefile from the current directory inside the Docker container, eg:

Code: Bash  [Select][+][-]
  1. #!/bin/sh
  3. docker run -it --rm -v `pwd`:/usr/src kveroneau/fpc:3.2.0 make "$@"

Running this script will spin up a temporary docker container to clean-room build your sources in the current directory using a modern Makefile.  When the docker container finishes, you should then see your binary files and also see the output from Make on your standard output.  This can obviously be used on something like a build server like Jenkins or CircleCI to automate builds.

Let me know if anybody has any questions, or needs some assistance in getting Docker up and running on their machines.


  • Full Member
  • ***
  • Posts: 113
Re: Docker image which can build both 16 and 32-bit MS-DOS apps
« Reply #1 on: September 23, 2021, 11:12:18 pm »
Just pushed a new Docker image for FPC 3.2.2, the current stable release.

This image contains the standard AMD64 compiler, along with both the Go32v2 and the i8086 builder.

The Git repo has also been updated with the latest Dockerfile and related files here:

It can be used in the exact same way as the previous image.


  • Hero Member
  • *****
  • Posts: 1175
    • Burdjia
Re: Docker image which can build both 16 and 32-bit MS-DOS apps
« Reply #2 on: October 02, 2021, 01:47:02 pm »
Great.  I have to remember this, and test it.

Thanks for the effort.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal


TinyPortal © 2005-2018