Running a Container that is to be Debugged

This topic describes how to run a base image and volume mount an application's executable and debug files so that you can debug the application.

Note: This topic does not apply if you are using Visual COBOL Development Hub as a stand-alone development environment.

When you run the container, you must make sure that the docker run command specifies the following in addition to any parameters that you would normally specify:

For example, the following is a docker run command you could use to run the native COBOL Hello World Docker demonstration that had been built into an image for use on 64-bit Windows platforms:

docker run -p 6100 --rm 
 --name helloworld-x64-debug 
 -v %CD%\src\bin\x64\Debug:c:\app 
 --workdir c:\app 
 --entrypoint cobdebugremote64 
 -it microfocus/edbuildtools:win_4.0_x64 
 port=6100

The parameters specified in the above docker run command are as follows:

-p 6100
Publishes port number 6100. This must be specified by an EXPOSE command in the Dockerfile that was used to create the image.
--rm
Specifies that Docker will automatically remove the container when it finishes running.
--name helloworld-x64-debug
Specifies the name to be used for the container.
-v %CD%\src\bin\x64\Debug:c:\app
Mounts the local folder %CD%\src\bin\x64\Debug into the folder c:\app in the container. %CD% refers to the current directory and can only be used if you run the docker run command from a Windows batch file. If you run the command from the command line you can use the PowerShell automatic variable ${PWD} or specify the current directory in full.
--workdir c:\app
Sets the working directory for the container. This must be the same folder that is specified by the -v parameter.

--entrypoint cobdebugremote64
Specifies the 64-bit cobdebugremote64 module to enable remote debugging. This is only required for native COBOL applications.
-it
Specifies that the container runs interactively.
microfocus/edbuildtools:win_4.0_x64
Specifies the name of the image to run. In this case, this is the 64-bit Windows version of the Enterprise Developer Build Tools for Windows image.
port=6100
A command line paramter for the container.

When the container is running, if the application running is in native COBOL a message such as the following is displayed to indicate that the container is running and cobdebugremote (or cobdebugremote64) is ready to connect for debugging:

Waiting for a connection on machine IP-address/container-name using port port-number.
Press 'Q' to quit.