While pushing the docker image (after successful login) from my host I am getting \"unauthorized: authentication required\".
Details below.
-bash-4.
Edit(13/08/2017)
Based on @KaraPirinc's comment, in docker version 17 in order to log in (Step 1),
docker login -u username -p password
I also had the same issue.This is how I resolve it.
Step 1: log in to docker hub
docker login --username=<user username> --email=<user email address>
Step2: create a repository in the docker hub. let's say "mysqlserver:sql".
docker push <user username>/mysqlserver:sql
My problem was an invalid Authorization token after 5 minutes. The push took more than 5 minutes because of the image size.
I've fixed it by increasing the "Authorization token duration" to 10 minutes.
I have received similar error for sudo docker push /sudo docker pull on ecr repository.This is because aws cli installed in my user(abc) and docker installed in root user.I have tried to run sudo docker push on my user(abc)
Fixed this by installed aws cli in root , configured aws using aws configure in root and run sudo docker push to ecr on root user
Try docker logout
first, then relogin with docker login
You can mv the xxx/.docker/config.json file somewhere for handle it. Then try to login again for create new config.json file.
#mv xx/.docker/config.json xx/.docker/config_old.json
#docker login https://index.docker.io/v1/
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: YOUR USERNAME
Password: YOUR PASSWORD
WARNING! Your password will be stored unencrypted in /xxx/.docker/config.json.
Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
Make sure you have more slots for private images.
In my case I converted a user into an organization and it lost it's one free private image, so previous pushes that worked, no longer worked.