Bug 1309739

Summary: docker push fails when pushing image to docker hub
Product: Red Hat Enterprise Linux 7 Reporter: Avesh Agarwal <avagarwa>
Component: dockerAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: amurdaca, dustymabe, dwalsh, lfriedma, lsm5, lsu, mjenner
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 15:17:15 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:
Bug Depends On:    
Bug Blocks: 1298318    

Description Avesh Agarwal 2016-02-18 15:12:53 UTC
Description of problem:

docker logging fails when pushing image to docker hub:

[root@openshift-112 ~]# docker push docker.io/deshuai/hello-openshift:v1

Do you really want to push to public registry? [y/n]: y
The push refers to a repository [docker.io/deshuai/hello-openshift] (len: 1)
f7591c834e4d: Image already exists 
0a9b9b6b06fb: Preparing 
unauthorized: access to the requested resource is not authorized

2. Some error log in docker demon
 msg="Handler for POST /v1.21/images/docker.io/deshuai/hello-openshift/push returned error: Error: Status 403 trying to push repository docker.io/deshuai/hello-openshift to official registry: needs to be forced"
 msg="HTTP Error" err="Error: Status 403 trying to push repository docker.io/deshuai/hello-openshift to official registry: needs to be forced" statusCode=403


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

How reproducible:
always

Steps to Reproduce:
http://fpaste.org/324435/62955145/

Actual results:
Pushing image to docker hub fails

Expected results:
Pushing image to docker hub works.

Additional info:
Changing docker.io to https://index.docker.io/v1/ in config.json solve the problem.

Comment 1 Antonio Murdaca 2016-02-18 15:16:54 UTC
Avesh, can you 'cat' $HOME/.docker/config.json? (be aware, hide the auth token pls)

Comment 2 Avesh Agarwal 2016-02-18 15:20:12 UTC
{
"auths": {
"docker.io": {
"auth": ..,
"email": "dma"
}
}
}

And changing docker.io to  https://index.docker.io/v1/ solved the problem

Comment 4 Antonio Murdaca 2016-02-18 15:28:28 UTC
Alright, thanks Avesh, this is definitely fixed in docker-1.10.x
An attempt was made to backport the fix to 1.9.x (https://github.com/runcom/docker/commit/c561d441a8a268a87be15ea19829b0dff56da35d) but it didn't make into the code base (even if it's shown merged)

Comment 7 Michal Minar 2016-02-29 12:42:15 UTC
*** Bug 1300808 has been marked as a duplicate of this bug. ***

Comment 8 Dusty Mabe 2016-04-11 17:10:49 UTC
The docker version in latest RHEL/centos has this problem still.

docker-1.9.1-25.el7.centos.x86_64
docker-1.9.1-25.el7.x86_64

```
[root@cloudhost ~]# docker push docker.io/dustymabe/bb

Do you really want to push to public registry? [y/n]: y
The push refers to a repository [docker.io/dustymabe/bb] (len: 1)
307ac631f1b5: Image push failed 
unauthorized: access to the requested resource is not authorized
```

Comment 10 Antonio Murdaca 2016-04-22 07:56:21 UTC
we merged https://github.com/projectatomic/docker/pull/130 which fixes this bug. Will rebuild docker 1.9 for rhel.

Comment 11 Luwen Su 2016-04-28 07:43:03 UTC
In docker-1.9.1-38.el7.x86_64, 

# docker login
Username: timesu
Password: 
Email: 
WARNING: login credentials saved in /root/.docker/config.json
Login Succeeded

# docker push docker.io/timesu/busybox
Do you really want to push to public registry? [y/n]: y
The push refers to a repository [docker.io/timesu/busybox] (len: 1)
307ac631f1b5: Pushed 
4b51ded9aed1: Pushed 
latest: digest: sha256:293ee253bd4949e2ef7e4437337543cc8132dd9abc2f4899df01b96508f87236 size: 2738


Move to verified

Comment 13 errata-xmlrpc 2016-05-12 15:17:15 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://rhn.redhat.com/errata/RHSA-2016-1034.html