To add a Dockerfile to a native COBOL project

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

Enterprise Developer lets you add a Dockerfile to a native COBOL project or to a native COBOL 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. The XML file must be available for selection from the Select Server Definition XML dialog box, so if you do want to use an XML file you must add it to your project before you add a Dockerfile to your project.

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 import a file into a project for information on adding a file to your project.

  1. Right-click your project in the Application Explorer view, COBOL Explorer view or Project Explorer view, and click New > Dockerfile.

    The New Dockerfile wizard is displayed.

  2. Select one of the following options regarding Enterprise Server/COBOL Server configuration:
    Do not add instructions to configure an Enterprise Server No enterprise server/COBOL server configuration details are added to the Dockerfile.
    Add intructions to configure an Enterprise Server cloning the one associated with this project Settings are copied from the enterprise server/COBOL server that is associated with the local project.
    Add intructions to configure an Enterprise Server using an XML file Settings from an existing enterprise server/COBOL server are copied from an exported XML file. (The XML file must be in the folder structure for the current project.)
  3. Click Next.
  4. On the second page, set the following options appropriately:
    Build layer repository The name of the repository for the image, which should contain a suitable build environment for the project (this is typically a build tools product).
    Deployment layer repository the name of the repository for the image, which should contain a suitable Run-Time System environment for the application (this is typically an Enterprise Server/COBOL Server product).
    Common image tag a tag name that is specified by the build and deploy repositories. Both build and deploy repositories should have a common tag.
  5. Click Finish.

    The Dockerfile is created and opened in the Dockerfile editor. If the project already contained a Dockerfile, it is renamed to Dockerfile.bak.

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.If you change the name of the "base" stage you must specify the new name in the project properties, as described in To specify project properties for containers.

    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 New > Dockerfile option in order to ensure that your development environment is correctly configured for working with containers.
  • If the base image is to contain an enterprise server region, you need to be aware that Enterprise Server security is now 'on' by default (see Getting Started with Default Enterprise Server Security) - any ES-related commands within the dockerfile (such as mfds, casstart, cassub, etc...) need to specify valid credentials within the command.