DEV Community

Cover image for Push Docker image to Azure Container Registry
Romil Lodaya
Romil Lodaya

Posted on

Push Docker image to Azure Container Registry

If you are already familiar with Docker and Docker Hub then in this post I’d like to introduce the Azure Container Registry which is an alternative to the well-known Docker Hub.

Things required before starting:

  1. Docker Desktop
  2. Azure CLI
  3. Azure Account

In order to start with Azure Container Registry, you need an Azure account which you can create easily with FREE Credits and also ACR is a very cheap service. Once you logged into Azure, Navigate to Azure Container Registry by clicking on New --> Search --> type Azure Container Registry. After that create a new ACR by filling in all details you want to add but make sure you enable admin access. After Two or three minutes your ACR will be created.

Once you created a resource navigate Access Keys to get the Login server, Username, and password which is required for the command line push your local Docker image to ACR.

Fig 1:Docker Login

Type Above fig command and replace [login-server] with your ACR resource EG: firstapp.azureacr.io [username] with firstapp and [password] with the hash password. Once completed, you should see Login succeeded! Message. After this you need to build your docker image with this command

docker build –f ./Dockerfile . –t node_vue_app
Enter fullscreen mode Exit fullscreen mode

Fig 2: Docker Tag to ACR resource

Final step is to push your local Docker image to ACR. Follow below image command to push. Keep in mind though that these repositories are private by default, which means that you have to perform authentication first.

Fig 3: Docker Push to ACR resource

And that’s it. You can make use of this container registry just like you used. In Part 2 we will see how we can deploy same thing using CI/CD with GitHub Workflow

Discussion (0)