Bug 1293604 - Cannot recognize the default authentication file created by docker login when pull private image
Summary: Cannot recognize the default authentication file created by docker login when...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Build
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Ben Parees
QA Contact: Wenjing Zheng
URL:
Whiteboard:
Depends On:
Blocks: 1308305
TreeView+ depends on / blocked
 
Reported: 2015-12-22 11:38 UTC by Wenjing Zheng
Modified: 2016-05-12 17:08 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1308305 (view as bug list)
Environment:
Last Closed: 2016-05-12 17:08:53 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Wenjing Zheng 2015-12-22 11:38:07 UTC
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
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 18:31:03 UTC
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 21:40:36 UTC
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 10:27:56 UTC
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 10:31:36 UTC
pls ignore the comment #3

Comment 5 XiuJuan Wang 2016-02-04 02:47:17 UTC
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.