6.5.6 Importing Images into a Registry

When you have set up a Docker registry server, you can import images into the registry so that they can be used to deploy containers. You may either pull images from a registry, such as the Oracle Container Registry, and then commit them to your local registry, or you may wish to create your own images based on upstream images.

To import images into a local Docker registry:

  1. Pull an image from a registry. For example, you can pull an image from the Oracle Container Registry:

    # docker pull container-registry.oracle.com/os/oraclelinux:latest
  2. Tag the image so that it points to the local registry. For example:

    # docker tag container-registry.oracle.com/os/oraclelinux:latest \
    localhost:5000/ol7image:v1 

    In this example, localhost is the hostname where the local registry is located and 5000 is the port number that the registry listens on. If you are working on a Docker Engine located on a different host to the registry, you must change the hostname to point to the correct host. Note the repository and tag name, ol7image:v1 in the example, must all be in lower case to be a valid tag.

  3. Push the image to the local registry. For example:

    # docker push localhost:5000/ol7image:v1

See Section 5.3, “Creating a Docker Image from an Existing Container” and Section 5.4, “Creating a Docker Image from a Dockerfile” for information on how you can create your own images. When you have committed a customized image, you can tag it and push it to your local registry as indicated in the steps above.