To add a Dockerfile to a native COBOL project

Note: This topic only applies to using native COBOL applications and native Unit Test projects in containers. To use .NET COBOL applications in containers you need to use the functionality described in Debugging and Running .NET COBOL Applications in Containers.

Enterprise Developer lets you add a Dockerfile to a native COBOL project or to a native Unit Test project to simplify the process of containerizing an existing application. The Dockerfile created by Enterprise Developer uses default values for details such as image names and includes basic instructions in order to create an image for the native COBOL project. If you need the Dockerfile to use non-default settings or to perform additional processing you can modify it once Enterprise Developer has added it to your project.

Note: As part of the Dockerfile creation process you can specify that the Dockerfile is to include commands to configure an enterprise server, the details of which are specified in an XML file that was created either by the casesxml import/export utility or from Server Explorer.

See casesxml for more information on the casesxml command, To export an enterprise server instance for information on using Server Explorer to export an enterprise server definition, and To add files to a COBOL project for information on adding a file to your project.

  1. Right-click your project in Solution Explorer and click Add > COBOL Docker Support.
  2. If the current project is not a Mainframe Subsystem Application project, the Add COBOL Docker Support dialog box is displayed.
    • In the Product drop-down select the product you want to tailor the generated Dockerfile. The text beneath the Product drop-down shows the image names that will be used in the generated Dockerfile for the product that is currently selected:
      • Deployment Image - specifies the image to use for running and debugging the build. If you use Build Tools as the deployment image, the program will be built and run in the Build Tools image.
      • Build Tools Image - specifies the image to use for building the program.
      • Runtime Image - specifies the image to use for running the program.
    • Click Create.
  3. If the current project is an Enterprise Server Application or a Mainframe Subsystem Application project, the Create Enterprise Server for container dialog box is displayed.

    Select one of the following, then click OK:

    • Use associated server to specify that the generated Dockerfile is to include commands to configure the enterprise server that is associated with the current project. Selecting this option runs the casesxml import/export utility for the relevant enterprise server.

      This option is not available for selection if the current project does not have an enterprise server associated with it.

    • Create new server to specify that the generated Dockerfile is to include commands to configure an enterprise server based on an XML file. Specify a name to use for imported enterprise server then browse to and select the XML file.

    A Docker.deploy folder is added to the project. This folder contains the enterprise server definition and a PowerShell script named DeployAndWait.ps1 which is used to deploy the enterprise server and run it in the container.

  4. The Dockerfile is created, added to the project, and a Docker debug profile is created.

    If the project already contained a Dockerfile you are asked if you want to rename it and generate a new Dockerfile. Click Yes to rename the existing Dockerfile (to Dockerfile.original) or No to leave the existing Dockerfile unchanged.

Note:
  • If you need to modify the Dockerfile created by Enterprise Developer, Micro Focus recommends that you maintain the same structure that is used by the one created by Enterprise Developer. In particular, you should not change any of the stage names in order to preserve the way in which the Dockerfile is built.

    You might want to look at some of the Dockerfiles supplied with the Enterprise Developer container demonstrations for guidance on the sort of changes to make.

  • Although it is possible to create a Dockerfile and manually add it to a native COBOL project Micro Focus recommends that you use the Add > COBOL Docker Support option in order to ensure that your development environment is correctly configured for working with containers.
  • In the Add COBOL Docker Support dialog box, the versions of the Runtime Image and the Built Tools Image must match therefore the dialog box only shows the Built Tools Images that match the one for the runtime. For example, if you use a Patch Update 1 Build Tools image, the dialog box only shows the relevant Patch Update 1 Runtime image. The images must target the same platform (x64 or x86) as well. If you want to specify images from different major product versions, you need to edit the Dockerfile manually.