Create base Docker image

Create a base Docker image containing an operating system and an API Gateway installation.

2 minute read

Create a base Docker image

To create a base Docker image containing an operating system and an API Gateway installation, use the build_base_image.py script. This script builds a base API Gateway Docker image using an API Gateway 7.7 Linux installer and a Docker image based on a standard or custom CentOS7 or RHEL7 operating system image.

Base image script options

You must specify the following as options when using the build_base_image.py script:

  • API Gateway 7.7 Linux installer
  • Operating system based on one of the following:
    • Standard CentOS7 Docker image downloaded from the public Docker registry
    • Standard RHEL7 Docker image downloaded from the Red Hat Docker registry
    • If you specify a custom CentOS7 or RHEL7-based OS Docker image, Docker first tries to find the custom image in the local registry, and then tries to download it from a remote registry

This script also supports additional options when generating a base image. For the latest script usage and options, run the script with no options, or with the -h option.

cd emt_containers-<version>
./build_base_image.py -h

See Best practices for running API management in Docker containers for additional information.

The following examples show how you can use the script to build base Docker images:

Create a base image based on standard CentOS7

The following example creates a base Docker image using a standard CentOS7 image.

cd emt_containers-<version>
./build_base_image.py --installer=apigw-installer.run --os=centos7

This example creates a base Docker image named apigw-base with a tag of latest. The image is based on a standard CentOS7 Docker image.

Create a base image based on standard RHEL7

The following example creates a base Docker image using a standard RHEL7 image.

cd emt_containers-<version>
./build_base_image.py --installer=apigw-installer.run --os=rhel7 --out-image=my-gw-base:1.0

This example creates a base Docker image named my-gw-base with a tag of 1.0. The image is based on a standard RHEL7 Docker image.

Create a base image based on custom CentOS7/RHEL7

The following example creates a base Docker image using a custom RHEL7 image.

cd emt_containers-<version>
./build_base_image.py --installer=apigw-installer.run --parent-image=my-custom-rhel:2.0 --out-image=my-custom-gw-base:1.0

This example creates a base Docker image named my-custom-gw-base with a tag of 1.0. The image is based on the specified my-custom-rhel:2.0 Docker image.