Bug 1308305 - Cannot recognize the default authentication file created by docker login when pull private image
Cannot recognize the default authentication file created by docker login when...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Build (Show other bugs)
3.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Abhishek Gupta
Wenjing Zheng
:
Depends On: 1293604
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-14 01:43 EST by Wenjing Zheng
Modified: 2016-05-23 11:09 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1293604
Environment:
Last Closed: 2016-05-23 11:09:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Wenjing Zheng 2016-02-14 01:43:58 EST
+++ This bug was initially created as a clone of Bug #1293604 +++

Description of problem:
Cannot recognize the default authentication file created by docker login when pull private image, below message appreas:
F1222 04:12:18.209420       1 builder.go:185] Error: build error: '/var/run/secrets/openshift.io/pull/.dockercfg': open /var/run/secrets/openshift.io/pull/.dockercfg: no such file or directory

Version-Release number of selected component (if applicable):
openshift v1.1-597-gea98cba
kubernetes v1.1.0-origin-1107-g4c8e6f4
etcd 2.1.2

How reproducible:
Always

Steps to Reproduce:
1. docker login to generate authentication file 
[root@ip-172-18-7-80 ~]# docker login
Username: wzheng
Password: 
Email: wzheng@redhat.com
WARNING: login credentials saved in /root/.docker/config.json
Login Succeeded
2. Create secret with this file
oc secrets new pull /root/.docker/config.json
3. Add the secret to builder service account
4. Add the secret to build strategy in build config file
5. Build with the file

Actual results:
Build failed for cannot get the authentication, still look for the old file

Expected result:
Since the file generated by docker login has been changed, build should start to find the file with new location

Additional info:
a. This option is added when below bug is found:
  # Create a new .docker/config.json secret named my-secret
  $ oc secrets new my-secret .dockerconfigjson=path/to/.docker/config.json
https://bugzilla.redhat.com/show_bug.cgi?id=1282426
b. Workaround of this issue is to copy the config.json to ~/.dockercfg, then build succeeds

--- Additional comment from Daniel Walsh on 2016-01-04 13:31:03 EST ---


Looks like the environment variables are not set correctly when running docker login.

man docker login
...
       You  can  log  into any public or private repository for which you have
       credentials.  When you log in, the command stores  encoded  credentials
       in  $HOME/.docker/config.json  on  Linux  or %USERPROFILE%/.docker/con‐
       fig.json on Windows.

--- Additional comment from Ben Parees on 2016-01-28 16:40:36 EST ---

this is the same issue being hit by https://bugzilla.redhat.com/show_bug.cgi?id=1302255

will fix via:
https://github.com/openshift/origin/pull/6887

--- Additional comment from wewang on 2016-02-03 05:27:56 EST ---

verified in 
openshift v1.1.1-361-g6408278
kubernetes v1.2.0-alpha.4-851-g4a65fa1
etcd 2.2.2

steps:
1. docker login 
2. oc secrets new pull /root/.dockercfg
3. Add the secret to builder service account
4. Add the secret to build strategy in build config file
     "strategy": {
                    "type": "Source",
                    "sourceStrategy": {
                        "from": {
                            "kind": "DockerImage",
                            "name": "docker.io/wewang58/ruby-20-centos7:latest"
                        },
                        "pullSecret": {
                            "name": "pull"
                        },

5. Build with the file and check the log
can Pulling Docker image docker.io/wewang58/ruby-20-centos7:latest ...

http://pastebin.test.redhat.com/345783

[root@dhcp-128-91 backup]# oc get builds
NAME                  TYPE      FROM          STATUS     STARTED          DURATION
ruby-sample-build-1   Source    Git@00cadc3   Complete   11 minutes ago   1m22s

--- Additional comment from wewang on 2016-02-03 05:31:36 EST ---

pls ignore the comment #3

--- Additional comment from XiuJuan Wang on 2016-02-03 21:47:17 EST ---

devenv-rhel7_3325
Could pull private image with this two apporachs to create secrets

oc secrets new pull ${HOME}/.docker/config.json
or
oc secrets new pull .dockerconfigjson=${HOME}/.docker/config.json
Move bug to verified.
Comment 1 Abhishek Gupta 2016-03-29 19:14:27 EDT
What is required to be done here for Online since this bug is fixed in Origin?
Comment 2 Wenjing Zheng 2016-03-29 22:12:21 EDT
Yes, this has been fixed and verified, please set this bug to ON_QA, so that qe can verify, thanks!
Comment 3 Wenjing Zheng 2016-03-29 22:46:48 EDT
Verified with latest online version:
openshift v3.2.0.6
kubernetes v1.2.0-36-g4a3f9c5
etcd 2.2.

Note You need to log in before you can comment on or make changes to this bug.