Oracle Cloud Infrastructure Documentation

Pulling Images Using the Docker CLI

You use the Docker CLI to pull images from Oracle Cloud Infrastructure Registry.

Your permissions control the images you can pull from Oracle Cloud Infrastructure Registry. You can pull images from repositories you've created, from public repositories, and from repositories that the groups to which you belong have been granted access by identity policies. If you belong to the Administrators group, you can pull images from any repository in the tenancy.

To pull images from Oracle Cloud Infrastructure Registry using the Docker CLI:

  1. If you already have an auth token, go to the next step. Otherwise:

    1. In the top-right corner of the Console, open the User menu (User menu icon) and then click User Settings to view the details.
    2. On the Auth Tokens page, click Generate Token.
    3. Enter a friendly description for the auth token. Avoid entering confidential information.
    4. Click Generate Token. The new auth token is displayed.
    5. Copy the auth token immediately to a secure location from where you can retrieve it later, because you won't see the auth token again in the Console.
    6. Close the Generate Token dialog.
  2. In a terminal window on the client machine running Docker, log in to Oracle Cloud Infrastructure Registry by entering docker login <region-code>.ocir.io, where <region-code> corresponds to the code for the Oracle Cloud Infrastructure Registry region you're using. For example, docker login iad.ocir.io. See Availability by Region Name and Region Code for the list of region codes.

  3. When prompted, enter your username in the format <tenancy_name>/<username>. For example, acme-dev/jdoe@acme.com. If your tenancy is federated with Oracle Identity Cloud Service, use the format <tenancy-name>/oracleidentitycloudservice/<username>.
  4. When prompted, enter the auth token you copied earlier.
  5. Pull the Docker image from Oracle Cloud Infrastructure Registry to the client machine by entering:

    docker pull <region-code>.ocir.io/<tenancy-name>/<repos-name>/<image-name>:<tag>

    where:

    • <region-code> is the code for the Oracle Cloud Infrastructure Registry region you're using. For example, iad. See Availability by Region Name and Region Code for the list of region codes.
    • ocir.io is the Oracle Cloud Infrastructure Registry name.
    • <tenancy-name> is the name of the tenancy that owns the repository from which you want to pull the image (for example, acme-dev). Note that your user must have access to the tenancy.
    • <repo-name> (optional) is the name of a repository from which you want to pull the image (for example, project01). Note that your user must have access to the repository. Omit this argument if the image does not exist within a repository (see About Repositories).
    • <image-name> is the name of the image that you want to pull from Oracle Cloud Infrastructure Registry (for example, acme-web-app)
    • <tag> is the tag of the image that you want to pull from Oracle Cloud Infrastructure Registry (for example, version2.0.test)

    For example:

    docker pull iad.ocir.io/acme-dev/project01/acme-web-app:version2.0.test

    Note that if you don't specify a <tag> in the docker pull command, Docker pulls the image that has the latest tag.

  6. Confirm that the image has been pulled from Oracle Cloud Infrastructure Registry by entering docker images and verifying that the list of images on the client machine now includes the image you just pulled.

    For example:

    $ docker images
    REPOSITORY                                  TAG                 IMAGE ID          CREATED       SIZE
    iad.ocir.io/acme-dev/project01/acme-web-app version2.0.test     8e0506e14874      1 minute ago  162.6 MB
    acme-web-app                                latest              8e0506e14874      2 hours ago   162.6 MB
    acme-web-app                                version1.0          7d9495d03763      2 hours ago   162.6 MB
    <none>                                      <none>              6ebd328f833d      5 hours ago   162.6 MB
    hello-world                                 latest              80b84820d442      5 weeks ago   890 B