docker unauthorized: authentication required - upon push with successful login
The solution you posted is not working for me...
This is what works for me:
Create the repository with the desired name.
When committing the image, name the image like the repository, including the username
<dockerusername>/desired-name
. For example,radu/desired-name
.
You'll need to log in to Docker.
Step 1: log in to docker hub
Based on @KaraPirinc's comment, in Docker version 17 in order to log in:
docker login -u username --password-stdin
Then enter your password when asked.
Step 2: create a repository in the docker hub.
Let's say "mysqlserver:sql".
docker push <user username>/mysqlserver:sql
OK! never mind; I found the solution. with 403 Suspected that the HTTP is not going to the right URL.
Change the file which has the login credentials stored the ~/.docker/config.json
from the default generated of
{
"auths": {
"docker.io": {
"auth": "XXXXXXXXXXXXX",
"email": "[email protected]"
}
}
}
to - Note the change from docker.io -> index.docker.io/v1. That is the change.
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "XXXXXXXXXXXXX",
"email": "[email protected]"
}
}
}
Hope that helps.
Note that the auth field should be 'username:password" base64 encoded. for example: "username:password" base64 encoded is "dXNlcm5hbWU6cGFzc3dvcmQ="
so your file would contain:
"auth": "dXNlcm5hbWU6cGFzc3dvcmQ="
if you are using heroku, be sure you did not forget to "heroku container:login" before pushing.