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
Copy file name to clipboardExpand all lines: articles/container-registry/container-registry-quickstart-task-cli.md
+18-19Lines changed: 18 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,10 @@
1
1
---
2
2
title: Quickstart - Build & run container image
3
-
description: Quickly run tasks with Azure Container Registry to build and run a container image on-demand, in the cloud.
3
+
description: Quickly run tasks with Azure Container Registry to build and run a Docker container image on-demand, in the cloud.
4
4
ms.topic: quickstart
5
-
ms.date: 04/02/2019
5
+
ms.date: 01/31/2020
6
6
---
7
+
7
8
# Quickstart: Build and run a container image using Azure Container Registry Tasks
8
9
9
10
In this quickstart, you use Azure Container Registry Tasks commands to quickly build, push, and run a Docker container image natively within Azure, showing how to offload your "inner-loop" development cycle to the cloud. [ACR Tasks][container-registry-tasks-overview] is a suite of features within Azure Container Registry to help you manage and modify container images across the container lifecycle.
@@ -34,11 +35,11 @@ Create a container registry using the [az acr create][az-acr-create] command. Th
34
35
az acr create --resource-group myResourceGroup --name myContainerRegistry008 --sku Basic
35
36
```
36
37
37
-
This example creates a *Basic* registry, a cost-optimized option for developers learning about Azure Container Registry. For details on available service tiers, see [Container registry SKUs][container-registry-skus].
38
+
This example creates a *Basic* registry, a cost-optimized option for developers learning about Azure Container Registry. For details on available service tiers, see [Container registry SKUs][container-registry-skus].
38
39
39
40
## Build an image from a Dockerfile
40
41
41
-
Now use Azure Container Registry to build an image. First, create a working directory and then create a Dockerfile named *Dockerfile* with the following content. This is a simple example to build a Linux container image, but you can create your own standard Dockerfile and build images for other platforms.
42
+
Now use Azure Container Registry to build an image. First, create a working directory and then create a Dockerfile named *Dockerfile* with the following content. This is a simple example to build a Linux container image, but you can create your own standard Dockerfile and build images for other platforms. Command examples in this article are formatted for the bash shell.
42
43
43
44
```bash
44
45
echo FROM hello-world > Dockerfile
@@ -47,7 +48,9 @@ echo FROM hello-world > Dockerfile
47
48
Run the [az acr build][az-acr-build] command to build the image. When successfully built, the image is pushed to your registry. The following example pushes the `sample/hello-world:v1` image. The `.` at the end of the command sets the location of the Dockerfile, in this case the current directory.
48
49
49
50
```azurecli-interactive
50
-
az acr build --image sample/hello-world:v1 --registry myContainerRegistry008 --file Dockerfile .
51
+
az acr build --image sample/hello-world:v1 \
52
+
--registry myContainerRegistry008 \
53
+
--file Dockerfile .
51
54
```
52
55
53
56
Output from a successful build and push is similar to the following:
@@ -104,23 +107,17 @@ Run ID: ca8 was successful after 10s
104
107
105
108
## Run the image
106
109
107
-
Now quickly run the image you built and pushed to your registry. In your container development workflow, this might be a validation step before you deploy the image.
108
-
109
-
Create a file *quickrun.yaml* in a local working directory with the following content for a single step. Substitute the login server name of your registry for *\<acrLoginServer\>*. The login server name is in the format *\<registry-name\>.azurecr.io* (all lowercase), for example, *mycontainerregistry008.azurecr.io*. This example assumes that you built and pushed the `sample/hello-world:v1` image in the previous section:
110
-
111
-
```yml
112
-
steps:
113
-
- cmd: <acrLoginServer>/sample/hello-world:v1
114
-
```
115
-
116
-
The `cmd` step in this example runs the container in its default configuration, but `cmd` supports additional `docker run` parameters or even other `docker` commands.
110
+
Now quickly run the image you built and pushed to your registry. Here you use [az acr run][az-acr-run] to run the container command. In your container development workflow, this might be a validation step before you deploy the image, or you could include the command in a [multi-step YAML file][container-registry-tasks-multi-step].
117
111
118
-
Run the container with the following command:
112
+
The following example uses `$Registry` to specify the registry where you run the command:
119
113
120
114
```azurecli-interactive
121
-
az acr run --registry myContainerRegistry008 --file quickrun.yaml .
115
+
az acr run --registry myContainerRegistry008 \
116
+
--cmd '$Registry/sample/hello-world:v1' /dev/null
122
117
```
123
118
119
+
The `cmd` parameter in this example runs the container in its default configuration, but `cmd` supports additional `docker run` parameters or even other `docker` commands.
120
+
124
121
Output is similar to the following:
125
122
126
123
```console
@@ -176,10 +173,10 @@ az group delete --name myResourceGroup
176
173
177
174
## Next steps
178
175
179
-
In this quickstart, you used features of ACR Tasks to quickly build, push, and run a Docker container image natively within Azure. Continue to the Azure Container Registry tutorials to learn about using ACR Tasks to automate image builds and updates.
176
+
In this quickstart, you used features of ACR Tasks to quickly build, push, and run a Docker container image natively within Azure, without a local Docker installation. Continue to the Azure Container Registry Tasks tutorials to learn about using ACR Tasks to automate image builds and updates.
0 commit comments