Push your first image to a private Docker container registry

  1. Home
  2. Push your first image to a private Docker container registry

This tutorial will help you to Push your first image to a private Docker container registry. An Azure container registry stores and manages private Docker container images, similar to the way Docker Hub stores public Docker images. You can use the Docker command-line interface (Docker CLI) for login, push, pull, and other operations on your container registry.

Log in to a registry

There are several ways to authenticate to your private container registry. The recommended method when working in a command line is with the Azure CLI command az acr login. For example, to log in to a registry named myregistry:

az acr login –name myregistry

You can also log in with docker login. For example, you might have assigned a service principal to your registry for an automation scenario. When you run the following command, interactively provide the service principal appID (username) and password when prompted.

Pull the official Nginx image

First, pull the public Nginx image to your local computer.

Run the container locally

Execute following docker run command to start a local instance of the Nginx container interactively (-it) on port 8080. The --rm argument specifies that the container should be removed when you stop it.

Create an alias of the image

Use docker tag to create an alias of the image with the fully qualified path to your registry. This example specifies the samples namespace to avoid clutter in the root of the registry.

Push the image to your registry

Now that you’ve tagged the image with the fully qualified path to your private registry, you can push it to the registry with docker push

Pull the image from your registry

Use the docker pull command to pull the image from your registry

Start the Nginx container

Use the docker run command to run the image you’ve pulled from your registry

Remove the image (optional)

If you no longer need the Nginx image, you can delete it locally with the docker rmi command.

To remove images from your Azure container registry, you can use the Azure CLI command az acr repository delete. For example, the following command deletes the manifest referenced by the samples/nginx:latest tag, any unique layer data, and all other tags referencing the manifest.

free practice test for AZ- 303

Go back to home page

Reference documentation – Push your first image to a private Docker container registry using the Docker CLI

Menu