At last, Embarcadero has released some oficial Docker images to run Delphi apps. Another good news is that you will be able to debug linux applications running in a container.
As you know, since RadStudio 10.2 you can target Linux for Delphi applications. Two years ago I wrote about how to run those apps inside Docker containers with an image created by me. But with the official images is easier!
Step by step
You need Docker for Windows or a docker server elesewhere. For this tutorial I’ll assume that you’ll use Docker for Windows, as it is the typical development setup.
Fire up a powershell and run:
> docker pull radstudio/paserver
> docker run -it -e PA_SERVER_PASSWORD=pass -p 64211:64211 -p 8082:8082 radstudio/paserver
Now you have PAServer running on a linux container. The password is “pass”, and the port to connect to is 64211.
The next step is to connect the RadStudio IDE to your docker container.
Create a new console application and add Linux 64 as target platform. Right-click on Linux 64 platform and select “Properties…”:
At SDK combo select “Add New…”:
At “Select a profile to connect”, choose “Add New…”:
Give it a descriptive name like “paserver4docker”:
Fill the “Remote machine field” with your container IP. If you are using Docker for Windows use “localhost” as the 64211 port is mapped to your container. Password for this example is “pass”:
Click on “Test Connection” and “Finish”. It will download a bunch of SDK files, and you’re almost done:
Click Ok, and run your project. In this example I’ve run a simple “Hello from Docker!” console application.
Another interesting feature is debugging your code running in a container. Just set a breakpoint and run your program. You can perform the usual debug actions like run step-by-step, inspect variables, set breakpoints, …
Final words
This was a long-waited feature since RadStudio Tokyo release. Embarcadero should improve the IDE integration with Docker for both Windows and Linux, as other popular IDE’s are doing for a long time
If you are curious, Embarcadero has released a set of Docker images with RadServer too. You can find them at: https://hub.docker.com/u/radstudio
That’s all! Leave a comment if you have any doubts or thoughts you want to share.
26/01/2020 at 08:43
hi…
i don’t know much about docker, but can i run delphi apps (gui) in docker?