Bug 1420279

Summary: Not possible to push to Docker Hub with latest docker
Product: Red Hat Enterprise Linux 7 Reporter: Marek Skalický <mskalick>
Component: dockerAssignee: Antonio Murdaca <amurdaca>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: amurdaca, lsm5, lsu, mskalick
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-26 14:33:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Skalický 2017-02-08 10:49:50 UTC
Description of problem:
After upgrade to latest docker (from docker-1.10.x) expected format of .docker/config.json changed.

When I run docker login it still prints "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." and I can login with my Docker Hub credentials.

However the result of the command has in .docker/config.json file this format:
{
	"auths": {
                "https://registry.access.redhat.com/v1/": {
                        "auth": "xxxxxxxxxxxxx",
                        "email": "mskalick"
                }
	}
}

So instead of "https://index.docker.io/v1/" it contains "https://registry.access.redhat.com/v1/". Although then is is possible to push to Docker Hub, it is very misleading. And if user have .docker/config.json from previous version, it is not possible to use it (pushing to Docker Hub is unauthorized).

Version-Release number of selected component (if applicable):
docker-1.12.5-14.el7.x86_64

How reproducible:
It happened to me after upgrade from  docker-1.10.3-59.el7 to docker-1.12.5-14.el7.

Actual results:
With docker login done by docker 1.10.x and after upgrade to latest docker it is not possible to push to Docker Hub.

Expected results:
Pushing to Docker Hub is possible after upgrade.

Comment 1 Antonio Murdaca 2017-02-08 10:53:06 UTC
can you please provide commands to reproduce this along with expected and current behavior? The docker login goes to whatever default registry you have configured with --add-registry in /etc/sysconfig/docker so apart from that misleading output about docker ID, a docker login should behave like that with projectatomic/docker.

Comment 2 Marek Skalický 2017-02-08 11:59:03 UTC
How reproducible:
1. system without docker
2. yum install docker-1.10.3-59.el7 && systemctl start docker
3. docker login docker.io (with your Docker Hub credentials) 
  In .docker/config.json there is:
{
	"auths": {
		"https://index.docker.io/v1/": {
			"auth": "xxxxxxxxxx",
			"email": "mskalick"
		}
	}
}

4. Now it is possible to push to personal namespace in Docker Hub
5. yum install docker-1.12.5-14.el7
6. Now it is NOT possible to push to personal namespace in Docker Hub (unauthorized: authentication required; .docker/config.json is the same)

Continues how it works for me:
7. docker login (with your Docker Hub credentials)
  In .docker/config.json there is:
{
	"auths": {
		"https://index.docker.io/v1/": {
			"auth": "xxxxxx",
			"email": "mskalick"
		},
		"https://registry.access.redhat.com/v1/": {
			"auth": "xxxxxx"
		}
	}
}
8. Now it is possible to push to personal namespace in Docker Hub


I am not sure how projectatomic docker should work. So is my example how it should work?

Comment 3 Antonio Murdaca 2017-02-08 12:03:35 UTC
(In reply to Marek Skalický from comment #2)
> How reproducible:
> 1. system without docker
> 2. yum install docker-1.10.3-59.el7 && systemctl start docker
> 3. docker login docker.io (with your Docker Hub credentials) 
>   In .docker/config.json there is:
> {
> 	"auths": {
> 		"https://index.docker.io/v1/": {
> 			"auth": "xxxxxxxxxx",
> 			"email": "mskalick"
> 		}
> 	}
> }
> 
> 4. Now it is possible to push to personal namespace in Docker Hub
> 5. yum install docker-1.12.5-14.el7
> 6. Now it is NOT possible to push to personal namespace in Docker Hub
> (unauthorized: authentication required; .docker/config.json is the same)

How are you pushing in 4. and 6.? can you show me the command? if you're pushing with just "username/imagename" then it shouldn't work in both 4. and 6. and you must push with "docker.io/username/imagename" since the default registry is "registry.access.redhat.com" when pushing unqualified images (w/o the hostname).

Comment 4 Marek Skalický 2017-02-08 12:12:45 UTC
For example with: "docker push docker.io/mskalick/mongodb-32-centos7"

Comment 5 Antonio Murdaca 2017-02-08 12:16:51 UTC
(In reply to Marek Skalický from comment #4)
> For example with: "docker push docker.io/mskalick/mongodb-32-centos7"

so that works with 1.10.3, and .docker/config.json has the docker.io entry but after you upgrade to 1.12.x, even if .docker/config.json has the docker.io entry, that push command doesn't work anymore with unauthorized error?

Comment 6 Marek Skalický 2017-02-08 12:22:42 UTC
(In reply to Antonio Murdaca from comment #5)
> so that works with 1.10.3, and .docker/config.json has the docker.io entry
> but after you upgrade to 1.12.x, even if .docker/config.json has the
> docker.io entry, that push command doesn't work anymore with unauthorized
> error?

Exactly.

docker.io entry have to be renamed to "https://registry.access.redhat.com/v1/" to get pushing to Docker Hub working again.

Comment 17 errata-xmlrpc 2017-05-26 14:33:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1325