Building a Natural Docker Image

#### Search Results

Search

# Building a Natural Docker Image

This document describes how to build a Natural Docker image and run the Natural container using scripts provided with Natural. It covers the following topics:

- About Building a Natural Docker Image

- Prerequisites for Building a Natural Docker Image

- Building and Running the Natural Docker Image

## About Building a Natural Docker Image

The starting point to prepare a docker container is the installation of the products in question. The installation should be done without `sudo`, but using the `afterinstallasroot` procedure.

After the installation of the appropriate Natural components has been accomplished, the preparation of Natural in a docker container can be started.

This is done in two steps:

- Preparation of a .tar file which contains all required components

- Building the docker image based on the .tar file

The advantage of this approach is that the .tar file does neither contain any configuration specifics nor license files. In the second step, the configuration is done via scripts. Therefore, building the docker image is always reproducible.

There are two ways to provide license and configuration file to the docker image:

- Include the license and configuration files into the docker image

- Mount the license and configuration files directory to your docker image

## Prerequisites for Building a Natural Docker Image

- Docker installation 1.13.1 or compatible,

- Depending on the use case, a product installation containing the packages:

  - Natural > Base Environment,

  - Natural > Development Environment,

  - Natural > Development Server,

  - Natural > ApplinX Interface,

  - Natural Security,

  - EntireX > Broker.

  - Natural for Ajax

## Building and Running the Natural Docker Image

In your <install_dir>/Natural/docker/ directory you will find six use cases for Natural:

- Natural / ApplinX – in directory NaturalApplinX

  Note
  For the above mentioned use cases an ApplinX server is required. For more information see the ApplinX documentation.

- Natural / ApplinX with Natural Security (NSC) – in directory NaturalApplinXNSC

  Note
  For the above mentioned use cases an ApplinX server is required. For more information see the ApplinX documentation.

- Natural / Natural Development Server - in directory NaturalDevelopmentServer

- Natural / Natural Development Server with Natural Security (NSC) - in directory NaturalDevelopmentServerNSC

- Natural / RPC with EntireX Attachmanager – in directory NaturalRPCService

- Natural for Ajax – in directory NaturalAjax

The scripts provided with Natural, support the following two methods of building a Docker image and running the Docker container:

- Mounting the License and Configuration Files into Container

- Configuring with Modified Docker File

### Mounting the License and Configuration Files into Container

In the following, you find an example for NaturalDevelopmentServerNSC. This example can be used for the other uses cases as well, but with additional license files.

To mount the license and configuration files into container, using default file names

1. Set your working directory to <install_dir>/Natural/docker/NaturalDevelopmentServerNSC.

2. Create the .tar file containing all the necessary files with the following command:

       ./ CreateNaturalDevelopmentNSC-tar.sh

3. Provide your configuration and license directories:

   1. License files in directory <install_dir>/License

      - Nat91.xml

      - Ndv91.xml

      - Nsc91.xml

   2. The Configuration files in directory <install_dir>/Configuration

      - NATURAL.INI

      - NATCONV.INI

      - NATCONF.CFG

      - SAGtermcap

   3. The parameter files in directory <install_dir>/Configuration

      - NATPARM.SAG

      - NDVPARM.SAG

      - NSCPARM.SAG

4. In case you do not provide specific configuration and parameter files, the default files from the installation will be taken. Build the Natural image, for example:

       docker build . -t natural-development-nsc:9.1.2

   In this case the license and configuration files are mounted during startup. You will need to map your Natural Development Server port during startup, for example:

       docker run -it -p 2799:2700 --name natndvnsc912 -e NSC_DBID=11 -e NSC_FNR=6 -v <installdir>/License/:/licenses natural-development-nsc:9.1.2

#### Advantages

Configuration changes can be persistent; if the configuration changes, you only need to rerun the container.

#### Disadvantage

The configuration files are mounted to the container. For troubleshooting, support will require an image, configuration files and the command you entered.

### Configuring with Modified Docker File

In the following, you find an example for NaturalDevelopmentServerNSC. This example can be used for the other uses cases as well, but with additional license files.

To copy the license and configuration files into the Docker image

1. Set your working directory to <install_dir>/Natural/docker/NaturalDevelopmentServerNSC.

2. Create the .tar file containing all the necessary files with the following command:

       ./ CreateNaturalDevelopmentNSC-tar.sh

3. Provide your configuration files into the current working directory, like::

   1. License files in the working directory

      - Nat91.xml

      - Ndv91.xml

      - Nsc91.xml

   2. The Configuration files in the working directory

      - NATURAL.INI

      - NATCONV.INI

      - NATCONF.CFG

      - SAGtermcap

   3. The parameter files in the working directory

      - NATPARM.SAG

      - NDVPARM.SAG

      - NSCPARM.SAG

4. Update the Docker file, for example:

       # Possibility to add a valid license file already to the image instead of
       # providing it during start up
       # e.g.:
       ADD nat91.xml /opt/softwareag/common/conf/
       ADD ndv91.xml /opt/softwareag/common/conf/
       ADD nsc91.xml /opt/softwareag/common/conf/

       # Possibility to add different config file already to the image instead of
       # providing it during start up
       # e.g.:
       ADD NATURAL.INI $NAT_HOME/etc
       ADD NATCONV.INI $NAT_HOME/etc
       ADD NATCONF.CFG $NAT_HOME/etc
       ADD SAGtermcap  $NAT_HOME/etc
       ADD NATPARM.SAG $NAT_HOME/prof
       ADD NDVPARM.SAG $NAT_HOME/prof
       ADD NSCPARM.SAG $NAT_HOME/prof

5. Build the Natural Docker image, for example:

       docker build . -t natural-development-nsc:9.1.2

   With this method, the Docker build copies the configuration into the image. You will need to map your Natural Development Server port during startup, for example:

       docker run -it -p 2799:2700 --name natndvnsc912 -e NSC_DBID=11 -e NSC_FNR=6 natural-development-nsc:9.1.2

#### Advantages

The complete configuration is in the image. For troubleshooting, support will require only the image and the command you entered.

#### Disadvantage

If the configuration changes, you will need to build a new image and rerun the container.

### On this page

- About Building a Natural Docker Image
- Prerequisites for Building a Natural Docker Image
- Building and Running the Natural Docker Image