Docker

Check Prerequisites

Verify that Docker is installed and running. The following command will display the Docker version if is running properly.

docker --version

Login

 Authenticate against the Azure Container Registry with the following command.

docker login --username USER_NAME --password PASSWORD ACR_RESOURCENAME.azurecr.io

List Images

docker images ls

Pull Image

C:\Users\user>docker pull mcr.microsoft.com/windows/nanoserver:20H2
20H2: Pulling from windows/nanoserver
87449b0b126f: Pull complete
Digest: sha256:491db8f33cebb3ba06156999702d74df4e876ebdd6ba5bb0396ab6d473f38392
Status: Downloaded newer image for mcr.microsoft.com/windows/nanoserver:20H2
mcr.microsoft.com/windows/nanoserver:20H2

C:\Users\user>docker image ls
REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
mcr.microsoft.com/windows/nanoserver   20H2                93b91810f1ca        3 weeks ago         263MB

Tag an Image

C:\Users\user>docker tag mcr.microsoft.com/windows/nanoserver:20H2 archipat.azurecr.io/mynano

C:\Users\user>docker image ls
REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
archipat.azurecr.io/mynano             latest              93b91810f1ca        3 weeks ago         263MB
mcr.microsoft.com/windows/nanoserver   20H2                93b91810f1ca        3 weeks ago         263MB

Pipeline Task Sample

Sample used in Azure DevOps Pipeline whereas the variables are defined within the pipeline.

docker -v

docker login --username $(acrAdminUsername) --password $(acrPassword) myacr.azurecr.io  

docker pull myacr.azurecr.io/myimage:latest