Enrico
Enrico

Reputation: 6212

How to pull a docker image from Azure Registry in a Azure Ubuntu virtual machine

I have created an Azure Registry where I deploy some docker container from the CD\CI in Azure DevOps.

Following the Microsoft documentation, I have created a service principal. So, I have username and password to use to pull images from the Azure Container Registry. I tried to pull the images locally and it is working. To connect to the Container registry I use this command:

docker login myazureregistry.azurecr.io --username --password

enter image description here

Now, I want to create a virtual machine in Azure to publicly access to the application in the container.

I created an Ubuntu virtual machine and installed Docker. I run the same command as before on the Ubuntu machine but I got an error:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/auth: dial unix /var/run/docker.sock: connect: permission denied

enter image description here

What is the problem? How have I to configure Ubuntu to connect to the Azure Container?

Upvotes: 1

Views: 1190

Answers (1)

Feuermann
Feuermann

Reputation: 344

Maybe you don't have permissions for use docker. Add your user to docker group for use docker command without sudo

sudo groupadd docker
sudo usermod -aG docker $USER

And after this run your login command. (If you use virtual machine, it may be necessary to restart the virtual machine for changes to take effect)

Upvotes: 0

Related Questions