Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Docker access denied

📅 2019-Sep-17 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Problem

Building a Docker image threw up this error:

$ docker build -f Dockerfile -t foobar
Sending build context to Docker daemon  1.115MB
Step 1/14 : FROM blah.com:5005/foobar:10.05
Get https://blah.com:5005/foobar:10.05: unauthorized: HTTP Basic: Access denied

Solution

This usually means that your Docker does not have authorization to the registry you are referring to. The registry is usually the domain part of the URL above. You need to use the docker login command to successfully login to the registry, so that docker can save the credentials for you so that future docker pull from the registry will work.

For the Docker registry URL used above, the command would be:

$ docker login blah.com

Tried with: Ubuntu 18.04