This topic outlines the steps that a Dockerfile must carry out to create a base image for COBOL Server.
By far the easiest, and the recommended, way to create a base image for COBOL Server is to use the container demonstration as described in The Container Demonstration for the COBOL Server Base Image. If you do use the container demonstration, you do not need to perform any of the steps described in this topic because the container demonstration does them all for you. The information in this topic is provided if you choose to write your own Dockerfile to create a COBOL Server base image.
Once you have built your COBOL Server base image you can then build additional images, based on the base image, that include your COBOL applications as well as COBOL Server. For more information on creating those additional images see Building an Image Containing an Application to Run under COBOL Server.
Before building a base image for COBOL Server you need to ensure that you have available the following:
To build a base image that includes COBOL Server your Dockerfile needs to perform the following steps:
When running setup_cobol_server_for_docker_8.0_platform.gz you need to specify the following parameters:
Doing this avoids the need to update the LD_LIBRARY_PATH environment variable.
All of the container demonstrations offer the option to create such a login image, and those images are tagged with the suffix "_login". See Running the Container Demonstration for the COBOL Server Base Image for information on how to specify that you want to create a _login image. For details on the commands required to build such an image, see the bld.sh script in any of the container demonstrations.
The build tool for image creation, bld.sh, enables you to create a custom Java Run-Time image from the downloaded Adopt OpenJDK. Using a custom JRE runtime helps reduce the size of the image, typically saving 70% on the size of the included Java component.
Support for custom Java runtimes is provided only for Java versions 11 and newer.
To create a custom JRE:
./bld.sh java nojre
You can customize the image further by changing the modules and locales to be included in the image. To do this, use the following options in addition to the java jre with the product bld.sh file:
Example:
The following command-line example helps create an image with some specific modules and with English, French and German locales:
./bld.sh java jre jremodules=java.base,java.management,java.logging,java.desktop,jdk.localedata,jdk.attach jreextraarg=--verbose jreincludelocale=en,fr,de
The build tool for image creation, bld.sh, supports an optional argument, dotnet, that adds .NET 6 support to an image.
Specify dotnet when you create the image, and either the .NET 6 SDK or .NET 6 Runtime will be included in your image. bld.sh uses the dotnet NuGet tool to register the products' NuGet repository and templates. In this way, the image is ready for use by you or your CI/CD system.
For Visual COBOL, bld.sh installs the .NET SDK. The NuGet package path is adjusted, and templates are registered. The installation is completed by a secondary script, dotnet_install.sh.
For COBOL ServerCOBOL Server, the .NET Runtime is used.