You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Push Docker image to private Azure registry | Microsoft Docs
2
+
title: Push Docker image to private Azure registry
3
3
description: Push and pull Docker images to a private container registry in Azure using the Docker CLI
4
4
services: container-registry
5
-
documentationcenter: ''
6
5
author: stevelas
7
6
manager: balans
8
-
editor: cristyg
9
-
tags: ''
10
-
keywords: ''
7
+
editor: mmacy
11
8
12
-
ms.assetid: 64fbe43f-fdde-4c17-a39a-d04f2d6d90a1
13
9
ms.service: container-registry
14
-
ms.devlang: na
15
10
ms.topic: article
16
-
ms.tgt_pltfrm: na
17
-
ms.workload: na
18
-
ms.date: 03/24/2017
11
+
ms.date: 12/01/2017
19
12
ms.author: stevelas
20
13
ms.custom: H1Hack27Feb2017
21
14
---
22
-
# Push your first image to a private Docker container registry using the Docker CLI
23
-
An Azure container registry stores and manages private [Docker](http://hub.docker.com) container images, similar to the way [Docker Hub](https://hub.docker.com/) stores public Docker images. You use the [Docker Command-Line Interface](https://docs.docker.com/engine/reference/commandline/cli/) (Docker CLI) for [login](https://docs.docker.com/engine/reference/commandline/login/), [push](https://docs.docker.com/engine/reference/commandline/push/), [pull](https://docs.docker.com/engine/reference/commandline/pull/), and other operations on your container registry.
24
15
25
-
For more background and concepts, see [the overview](container-registry-intro.md)
16
+
# Push your first image to a private Docker containerregistry using the Docker CLI
26
17
18
+
An Azure container registry stores and manages private [Docker](http://hub.docker.com) container images, similar to the way [Docker Hub](https://hub.docker.com/) stores public Docker images. You use the [Docker command-line interface](https://docs.docker.com/engine/reference/commandline/cli/) (Docker CLI) for [login](https://docs.docker.com/engine/reference/commandline/login/), [push](https://docs.docker.com/engine/reference/commandline/push/), [pull](https://docs.docker.com/engine/reference/commandline/pull/), and other operations on your container registry.
27
19
20
+
In the following steps, you download an official NGINX image from the public Docker Hub registry, tag it for your private Azure container registry, push it to your registry, and then pull it from the registry.
28
21
29
22
## Prerequisites
23
+
30
24
***Azure container registry** - Create a container registry in your Azure subscription. For example, use the [Azure portal](container-registry-get-started-portal.md) or the [Azure CLI 2.0](container-registry-get-started-azure-cli.md).
31
25
***Docker CLI** - To set up your local computer as a Docker host and access the Docker CLI commands, install [Docker Engine](https://docs.docker.com/engine/installation/).
32
26
33
27
## Log in to a registry
34
-
Run `docker login` to log in to your container registry with your [registry credentials](container-registry-authentication.md).
35
28
36
-
The following example passes the ID and password of an Azure Active Directory [service principal](../active-directory/active-directory-application-objects.md). For example, you might have assigned a service principal to your registry for an automation scenario.
29
+
There are [several ways to authenticate](container-registry-authentication.md) to your private container registry. The recommended method when working in a command line is with the Azure CLI command [az acr login](/cli/azure/acr?view=azure-cli-latest#az_acr_login):
30
+
31
+
```azurecli
32
+
az acr login --name <acrName>
33
+
```
34
+
35
+
You can also log in with `docker login`. The following example passes the ID and password of an Azure Active Directory [service principal](../active-directory/active-directory-application-objects.md). For example, you might have [assigned a service principal](container-registry-authentication.md#service-principal) to your registry for an automation scenario.
> Make sure to specify the fully qualified registry name (all lowercase). In this example, it is `myregistry.azurecr.io`.
41
+
Both commands returns `Login Succeeded` once completed. If you use `docker login`, you might also see a security warning recommending the use of the `--password-stdin` parameter. While its use is outside the scope of this article, we recommend following this best practice. See the [docker login](https://docs.docker.com/engine/reference/commandline/login/) command reference for more information.
44
42
45
-
## Steps to pull and push an image
46
-
The follow example downloads the Nginx image from the public Docker Hub registry, tags it for your private Azure container registry, pushes it to your registry, then pulls it again.
43
+
> [!TIP]
44
+
> Make sure to specify the fully qualified registry name (all lowercase) when you use `docker login` and when you tag your images. In this example, the fully qualified name is *myregistry.azurecr.io*.
47
45
48
-
**1. Pull the Docker official image for Nginx**
46
+
##Pull the official NGINX Docker image
49
47
50
-
First pull the public Nginx image to your local computer.
48
+
First, pull the public NGINX image to your local computer.
51
49
52
50
```
53
51
docker pull nginx
54
52
```
55
-
**2. Start the Nginx container**
56
53
57
-
The following command starts the local Nginx container interactively on port 8080, allowing you to see output from Nginx. It removes the running container once stopped.
54
+
You can optionally execute following command to start a local instance of the NGINX container on port 8080, allowing you to see output from NGINX. It removes the running container once stopped.
58
55
59
56
```
60
57
docker run -it --rm -p 8080:80 nginx
61
58
```
62
59
63
-
Browse to [http://localhost:8080](http://localhost:8080) to view the running container. You see a screen similar to the following one.
60
+
Browse to [http://localhost:8080](http://localhost:8080) to view the running container. You see a screen similar to the following:
64
61
65
62

66
63
67
-
To stop the running container, press [CTRL]+[C].
64
+
To stop the container, press `Control+C`.
68
65
69
-
**3. Create an alias of the image in your registry**
66
+
##Create an alias of the image for your registry
70
67
71
68
The following command creates an alias of the image, with a fully qualified path to your registry. This example specifies the `samples` namespace to avoid clutter in the root of the registry.
72
69
73
70
```
74
71
docker tag nginx myregistry.azurecr.io/samples/nginx
75
-
```
72
+
```
76
73
77
-
**4. Push the image to your registry**
74
+
##Push the image to your registry
78
75
79
76
```
80
77
docker push myregistry.azurecr.io/samples/nginx
81
78
```
82
79
83
-
**5. Pull the image from your registry**
80
+
##Pull the image from your registry
84
81
85
82
```
86
83
docker pull myregistry.azurecr.io/samples/nginx
87
84
```
88
85
89
-
**6. Start the Nginx container from your registry**
86
+
##Start the NGINX container from your registry
90
87
91
88
```
92
89
docker run -it --rm -p 8080:80 myregistry.azurecr.io/samples/nginx
@@ -96,19 +93,12 @@ Browse to [http://localhost:8080](http://localhost:8080) to view the running con
96
93
97
94
To stop the running container, press [CTRL]+[C].
98
95
99
-
**7. (Optional) Remove the image**
96
+
## Remove the image (optional)
100
97
101
98
```
102
99
docker rmi myregistry.azurecr.io/samples/nginx
103
100
```
104
101
105
-
##Concurrent Limits
106
-
In some scenarios, executing calls concurrently might result in errors. The following table contains the limits of concurrent calls with "Push" and "Pull" operations on Azure container registry:
Now that you know the basics, you are ready to start using your registry! For example, start deploying container images to an [Azure Container Service](https://azure.microsoft.com/documentation/services/container-service/) cluster.
103
+
104
+
Now that you know the basics, you're ready to start using your registry! For example, deploy container images from your registry to an [Azure Container Service (AKS)](../aks/tutorial-kubernetes-prepare-app.md) cluster.
0 commit comments