Bug 1293604 - 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 Origin
Classification: Red Hat
Component: Build (Show other bugs)
3.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Ben Parees
Wenjing Zheng
:
Depends On:
Blocks: 1308305
  Show dependency treegraph
 
Reported: 2015-12-22 06:38 EST by Wenjing Zheng
Modified: 2016-05-12 13:08 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1308305 (view as bug list)
Environment:
Last Closed: 2016-05-12 13:08:53 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 2015-12-22 06:38:07 EST
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
Comment 1 Daniel Walsh 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.
Comment 2 Ben Parees 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
Comment 3 wewang 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
Comment 4 wewang 2016-02-03 05:31:36 EST
pls ignore the comment #3
Comment 5 XiuJuan Wang 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.

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