Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1598477 - Fail to import image from registry with basic auth
Summary: Fail to import image from registry with basic auth
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Image
Version: 3.9.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: 3.9.z
Assignee: Oleg Bulatov
QA Contact: Dongbo Yan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-05 15:24 UTC by Juan Luis de Sousa-Valadas
Modified: 2018-08-27 14:18 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-20 14:01:22 UTC
Target Upstream Version:
jdesousa: needinfo-
jdesousa: needinfo-


Attachments (Terms of Use)

Description Juan Luis de Sousa-Valadas 2018-07-05 15:24:26 UTC
Description of problem:
Cannot import an image from an docker registry API v2 and basic auth

Version-Release number of selected component (if applicable):
3.9.14

How reproducible:
Always

Steps to Reproduce:
1- docker --config ~/pull-secret login -u xxxxxxx -p xxxxxxxxxxxxxxx -e xxxxxxxxx registry.fqdn
2- oc secrets new registry-secret .dockerconfigjson  ~/pull-secret
3- oc secrets add serviceaccount/default secrets/registry-secret --for=pull
4- oc import-image registry.fqdn/org/image:tag --confirm

Actual results:
oc describe is <image>

# oc describe imagestream
Name:                   <imagestream>
Namespace:              <ns>
Created:                7 days ago
Labels:                 xx=xx
                        yy=yy
Annotations:            openshift.io/image.dockerRepositoryCheck=2018-06-18T10:32:37Z
Docker Pull Spec:       docker-registry.default.svc:5000/<ns>/<is>
Image Lookup:           local=false
Unique Images:          0
Tags:                   1

0.2
  tagged from registry.fqdn/<org>/<name>:<tag>

  ! error: Import failed (InternalError): Internal error occurred: Get https://registry.fqdn/v2/<org>/<name>/manifests/<tag>: unknown: Authentication is required
      7 days ago

Expected results:
Imports the image successfully

Additional info:
cat ~/pull-secret
{
	"auths": {
		"registry.fqdn": {
			"auth": "BASIC-AUTH-B64"
		}
	}
}


curl -vv -H 'Authorization: Basic BASIC-AUTH-B64' https://registry.fqdn/v2/<org>/<name>/manifests/<tag>

returns the expected manifest

Comment 1 Maciej Szulik 2018-07-06 09:32:16 UTC
Images fall under's devexp territory currently.

Comment 2 Ben Parees 2018-07-06 13:46:22 UTC
My first suggestion would be to create the secret manually instead:

oc create secret generic registry-secret --type=kubernetes.io/dockerconfigjson --from-file=.dockerconfigjson=pull-secret

as there have been a variety of issues w/ the "oc new secret registry-secret" command which you may be hitting.

Comment 3 Juan Luis de Sousa-Valadas 2018-07-06 17:11:44 UTC
> oc create secret generic registry-secret \
> --type=kubernetes.io/dockerconfigjson --from-file=.dockerconfigjson=pull-secret

Has the same behavior

Comment 4 Oleg Bulatov 2018-07-11 13:03:36 UTC
Sorry, I can't reproduce it. Please check your passwords and content of secrets manually.

$ docker run --entrypoint htpasswd registry:2 -Bbn admin qwerty >./htpasswd.tmp
$ docker run --rm -it -p 5000:5000 --name registry-htpasswd \
    -v `pwd`/htpasswd.tmp:/htpasswd.tmp \
    -e "REGISTRY_AUTH=htpasswd" \
    -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
    -e REGISTRY_AUTH_HTPASSWD_PATH=/htpasswd.tmp \
    registry:2
# push images into the registry
$ oc create secret generic registry-secret  --type=kubernetes.io/dockerconfigjson --from-file=.dockerconfigjson=pull-secret/config.json 
secret "registry-secret" created
$ oc import-image $(my_ipv4):5000/busybox:latest --insecure --confirm
The import completed successfully.

$ oc version
oc v3.9.14-1+4efa2ca-dirty
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://127.0.0.1:8443
openshift v3.9.0+71543b2-33
kubernetes v1.9.1+a0ce1bc657


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