To push a Docker container image to the Azure Container Registry
Build the Docker container image
- Navigate to https://www.docker.com/ and create a free Docker Hub account
- Install the Docker Desktop application
- Start the Docker Desktop application
- Open a terminal and navigate to the application root directory where the Dockerfile is located
- In the terminal execute the command
docker build -t MY_IMAGE . - Push the image to the registry
az login
az acr login --name MY_REGISTRY
docker tag MY_IMAGE:latest MY_REGISTRY.azurecr.io/MY_REPOSITORY/MY_IMAGE:latest
docker push MY_REGISTRY.azurecr.io/MY_REPOSITORY/MY_IMAGE:latest
Troubleshooting
Error message when building the image
docker build -t …:latest .
ERROR: error during connect: Head “http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/_ping”: open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.
Solution
Start the Docker Desktop application
Error message when pushing the image to Azure Container Registry
error from registry: authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: 2a33d0ac-091c-4158-b927-397c6e5692cf
Solution