Building a Docker Image Without an Internet Connection

Download and install wget and unzip utilities to build a Docker image without an internet connection.

In $AF_HOME/docker/base/1.0/Dockerfile, the "FROM centOS" instruction initializes a new build stage and sets the base image for subsequent instructions. You can accept the default base image, which is the centOS image from the Docker's public repository, or you can change the instruction and provide a valid source for a different base image. You can pull a valid base image from the Docker's public repository or you can create your own base image, push it to a public or private Docker registry, and then use the newly created image as a base image. For more information about creating your own base Docker image, see the Docker documentation related to Creating a Base Image.
In $AF_HOME/docker/base/1.0/Dockerfile, you can find instructions for downloading wget and unzip utilities. These instructions can be modified to pick up the installers of the utilities from the Docker context and install them in the image.
Note: In this case, the Docker context for $AF_HOME/docker/base/1.0/Dockerfile is $AF_HOME/docker/base/1.0.

Perform the following steps to download the wget and unzip utilities:

Procedure

  1. Download and install the wget and unzip utilities.
  2. Copy the installer (.rpm) files for the wget and unzip utilities to the ​Docker context directory.
  3. Modify $AF_HOME/docker/base/1.0/Dockerfile to include the instruction to copy from the Docker context to run the installers:
    1. Add a COPY command for both the utility installers.
    2. Change the command yum -y install wget unzip to yum localinstall -y wget*.rpm unzip*.rpm.