User cannot create imagestreammappings in project - Trying to push images from docker to openshift registry pod
I'm trying to push images from my docker server to openshift registry pod (using --insecury-registry option) - All in the same server.
When I run "docker login" to my openshift registry pod, I got "Login Succeeded".
Trying to push images:
The push refers to a repository [192.168.169.3:5000/fap/nginx-php-fpm] 7c3b8374d271: Layer already exists 89e8906b34ea: Layer already exists c31410f0c313: Layer already exists 2cabfdd3a814: Layer already exists 9532bea0a2a8: Layer already exists c7075a30f0d0: Layer already exists 81065226de3c: Layer already exists 52173972f530: Layer already exists dbc47c28af5e: Layer already exists 15958368299e: Layer already exists efcbc44ba6d0: Layer already exists 526b6620c0c4: Layer already exists 8b0be68b7bd9: Layer already exists 15f1eedde63a: Layer already exists 921a96fb3071: Layer already exists b95e2d0f329b: Layer already exists 3220fa602677: Layer already exists 4a33fced152f: Layer already exists 4fe15f8d0ae6: Layer already exists Received unexpected HTTP status: 500 Internal Server Error
Seeing the registry pod logs:
time="2016-08-25T19:07:15.565760159Z" level=info msg="total size of image sha256:f1a8ca09ec471b99007c42f63348908b389cc500e1806f52da343b4be34afdea with docker ref 172.30.139.215:5000/fap/nginx-php-fpm@sha256:f1a8ca09ec471b99007c42f63348908b389cc500e1806f52da343b4be34afdea: 66887912" go.version=go1.6.3 http.request.contenttype="application/vnd.docker.distribution.manifest.v1+prettyjws" http.request.host="192.168.169.3:5000" http.request.id=8df35956-3225-43df-ad99-f2d88939f4c8 http.request.method=PUT http.request.remoteaddr="192.168.169.1:46334" http.request.uri="/v2/fap/nginx-php-fpm/manifests/latest" http.request.useragent="docker/1.10.3 go/go1.4.2 git-commit/7ffc8ee-unsupported kernel/3.10.0-327.22.2.el7.x86_64 os/linux arch/amd64" instance.id=ed892659-fbaf-41f8-b7fa-43192e8f8d35 vars.name="fap/nginx-php-fpm" vars.reference=latest time="2016-08-25T19:07:15.572663801Z" level=error msg="error creating ImageStreamMapping: User "system:serviceaccount:fap:registry" cannot create imagestreammappings in project "fap"" go.version=go1.6.3 http.request.contenttype="application/vnd.docker.distribution.manifest.v1+prettyjws" http.request.host="192.168.169.3:5000" http.request.id=8df35956-3225-43df-ad99-f2d88939f4c8 http.request.method=PUT http.request.remoteaddr="192.168.169.1:46334" http.request.uri="/v2/fap/nginx-php-fpm/manifests/latest" http.request.useragent="docker/1.10.3 go/go1.4.2 git-commit/7ffc8ee-unsupported kernel/3.10.0-327.22.2.el7.x86_64 os/linux arch/amd64" instance.id=ed892659-fbaf-41f8-b7fa-43192e8f8d35 vars.name="fap/nginx-php-fpm" vars.reference=latest
How can I give the necessary permissions for push images to openshift registry?
Version
docker version Client: Version: 1.10.3 API version: 1.22 Package version: docker-common-1.10.3-44.el7.x86_64 Go version: go1.4.2 Git commit: 7ffc8ee-unsupported Built: Fri Jun 17 15:27:21 2016 OS/Arch: linux/amd64
Server: Version: 1.10.3 API version: 1.22 Package version: docker-common-1.10.3-44.el7.x86_64 Go version: go1.4.2 Git commit: 7ffc8ee-unsupported Built: Fri Jun 17 15:27:21 2016 OS/Arch: linux/amd64
oc version oc v1.3.0-alpha.3+1148c68 kubernetes v1.3.0+507d3a7 features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://10.8.7.213:8443 openshift v1.3.0-alpha.3+1148c68 kubernetes v1.3.0+507d3a7
Additional Information
[try to run $ oadm diagnostics command if possible]
[if you are reporting issue related to builds, provide build logs with BUILD_LOGLEVEL=5]
[consider attaching output of the $ oc get all -o json -n <namespace> command to the issue]
[visit https://docs.openshift.org/latest/welcome/index.html]
@miminar @liggitt When did pushes start requiring "create" on "imagestreammapping"? Even the auto-provision case only required "create" on "imagestream" before.
@Shyckymn wait, which namespace is your docker registry in? We grant rights to the one in default, but it looks like you may have created it in fap, which will cause multiple problems. Can you double check which namespace your internal registry is located in?
The registry creates the mappings as itself (not as the pusher), and has done so for a long time. Permission to create those is included in the system:registry role. It looks like they are running the registry as a different user in a different namespace
the oadm registry command creates a ClusterRoleBinding for the registry service account, so it should have had the permissions it needed. @Shyckymn, did you get any errors when running oadm registry? What does oc get clusterrolebindings | grep system:registry show?
@liggitt, thanks for your support. I removed the "fap" project and all the objects related to it.
When I run "oc login -u system:admin", there are now four projects:
$ oc login -u system:admin Logged into "https://10.8.7.213:8443" as "system:admin" using existing credentials.
You have access to the following projects and can switch between them with 'oc project
- default kube-system openshift openshift-infra
Using project "default".
When I try to get pods, I can see that there is an error related to the registry in default project:
$ oc get pods NAME READY STATUS RESTARTS AGE docker-registry-1-deploy 0/1 Error 0 2d
$ oc describe service docker-registry
Name: docker-registry
Namespace: default
Labels: docker-registry=default
Selector: docker-registry=default
Type: ClusterIP
IP: 172.30.60.46
Port: 5000-tcp 5000/TCP
Endpoints:
There's no endpoint available.
$ oc logs docker-registry-1-deploy Error from server: Error response from daemon: No such container: 66187f136d4e3b13bcbdcb380f269e08b1a71b8f217c4771b048165775a53053
Can you help me to recreate this registry following the correct steps?
Thanks in advance.
Restarting the enrivonment and following the instructions from: https://docs.openshift.com/enterprise/3.1/install_config/install/docker_registry.html Now everything works! Thanks @liggitt & @danmcp!