This topic describes how to run a
Visual COBOL Build Tools for Windows base image and volume mount an application's
classes and debug files so that you can debug the application.
Note:
This topic only applies to using
JVM COBOL applications in containers. To use native COBOL applications in containers you need to use the functionality described in
Debugging and Running Native COBOL Applications in Containers.
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:
- A
java command with remote debugging options to overwrite the default command for the container. This means that when the container
runs it starts the process that is required to enable remote debugging.
- The port that the container will listen on. If using DHCP or TCP tunneling in the container, the port must be specified by
an EXPOSE command in the Dockerfile that was used to create the image
For example, the following is a
docker run command you could use to run the
JVM COBOL Hello World project supplied as a container demonstration:
Windows:
docker run -p 8000 --rm
--name helloworld-x64-debug
--cap-add=SYS_PTRACE
-v %CD%\bin:c:\app
--workdir c:\app
-it microfocus/edbuildtools:win_7.0_x64
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 com.microfocus.example.Program1
UNIX:
docker run -p 6100
--cap-add=SYS_PTRACE
--name helloworld-x64-debug
-v /home/user/workspace/simpleproj/New_Configuration.bin:/home/root_docker/app
--workdir /home/root_docker/app
-it microfocus/vcdevhub:rhel7_5.0_x64_pu10_login
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 com.microfocus.example.Program1
The parameters specified in the above
docker run command are as follows:
- -p 8000
- Publishes port number 8000.
- --rm
- Specifies that the container is to be automatically removed when it finishes running.
- --name helloworld-x64-debug
- Specifies the name to be used for the container.
- --cap-add=SYS_PTRACE
- Allows debugging inside a Linux container. UNIX only.
- -v %CD%\bin:c:\app
- Mounts the local folder
%CD%\bin into the folder
c:\app in the container.
%CD% refers to the current directory.
Windows only.
- -v /home/user/workspace/simpleproj/New_Configuration.bin:/home/root_docker/app
- Mounts the local folder
/home/user/workspace/simpleproj/New_Configuration.bin into the folder
/home/root_docker/app in the container.
UNIX only.
- --workdir c:\app
- Sets the working directory for the container. This must be the same folder that is specified by the
-v parameter.
Windows only
- --workdir /home/root_docker/app
- Sets the working directory for the container. This must be the same folder that is specified by the
-v parameter.
UNIX only.
- -it
- Specifies that the container runs interactively.
- microfocus/edbuildtools:win_7.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.
Windows only
- microfocus/vcdevhub:rhel7_5.0_x64_pu10_login
- Specifies the name of the image to run.
UNIX only.
-
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 com.microfocus.example.Program1
- Specifies the
java command that enables remote debugging for the class
com.microfocus.example.Program1 on port 8000.
When the container is running, a message such as the following is displayed to indicate that the container is running and
the Java runtime environment is ready to connect for debugging:
Listening for transport dt_socket at address: 8000