We will learn how to:
- Download Docker images from a remote repository using the 'docker pull' command.
- Give a downloaded image a new repository name and tag using the 'docker tag' command.
- Login to a remote repository using the 'docker login' command.
- Push a locally tagged image to a remote repository using the 'docker push' command.
- Understand how to work with Azure Container Registry by specifying the specific repository name acruserakdev.azurecr.io/samples/
- Understand how to specify the specific version of image by using the tag v1.
First, we will use the command 'docker pull' to download the 'hello-world' image from the Microsoft Container Registry, or MCR.
The command is
'docker pull mcr.microsoft.com/hello-world'.
Next,
we will also pull the 'nginx' image with version 1.15.5-alpine using the command
'docker pull mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine'.
Now that we have these images downloaded, we will use the 'docker tag' command to give them a new repository name and tag.
For the 'hello-world' image, the command is
'docker tag mcr.microsoft.com/hello-world acruserakdev.azurecr.io/samples/hello-world:v1'
and for
'nginx' image the command is
'docker tag mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpineacruserakdev.azurecr.io/samples/nginx:v1'
Before we can push the images to the new repository, we need to login with the command 'docker login'. Then we will use the 'docker push' command to push the tagged images to the new repository. For the 'hello-world' image, the command is 'docker push acruserakdev.azurecr.io/samples/hello-world:v1' and for the 'nginx' image, the command is 'docker push acruserakdev.azurecr.io/samples/nginx:v1'. And that's it, we have successfully pulled and pushed Docker images with a new repository and tag."
docker pull mcr.microsoft.com/hello-world
docker pull mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
docker tag mcr.microsoft.com/hello-world acruserakdev.azurecr.io/samples/hello-world:v1
docker tag mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine acruserakdev.azurecr.io/samples/nginx:v1
docker login
docker push acruserakdev.azurecr.io/samples/hello-world:v1
docker push acruserakdev.azurecr.io/samples//nginx:v1
No comments:
Post a Comment