在 Ubuntu 桌面上,使用 minishift 启动 OC 集群。docker 注册表在默认命名空间中可用。
如何为在 openshift 集群内运行的 docker 注册表设置身份验证?如何允许开发人员、系统或任何 openshift 用户等用户向/从内部 docker 注册表推送/拉取图像?
我已经在 openshift 中启用了 docker 服务的路由。
root@desktop:~# docker login -p 5d2XKusYJ9xB6sg1_uRfwPE8Ap3FQMg8_MrR9IEw3N8 -u aprasath docker-registry-default.127.0.0.1.nip.io
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
root@desktop:~# docker push docker-registry-default.127.0.0.1.nip.io/myproject/hello-world
The push refers to repository [docker-registry-default.127.0.0.1.nip.io/myproject/hello-world]
af0b15c8625b: Pushing [==================================================>] 3.584kB
unauthorized: authentication required
root@desktop:~# minishift addons list
- admin-user : enabled P(0)
- registry-route : enabled P(0)
镜像流创建、标记和推送到下面的注册表输出。
root@desktop:~# oc create imagestream ghost
Error from server (AlreadyExists): imagestreams.image.openshift.io "ghost" already exists
root@desktop:~ docker tag ghost docker-registry-default.127.0.0.1.nip.io/myproject/ghost:latest
root@desktop:~ docker push docker-registry-default.127.0.0.1.nip.io/myproject/ghost:latest
The push refers to repository [docker-registry-default.127.0.0.1.nip.io/myproject/ghost]
6545fabd1db4: Pushing [==================================================>] 4.096kB
e1b5357c9029: Pushing [==================================================>] 205.2MB/205.2MB
2f546e8c419e: Pushing [==================================================>] 25.33MB/25.33MB
2f5caec27732: Pushing [==================================================>] 1.287MB/1.287MB
da4dc4c42b60: Pushing [==================================================>] 3.584kB
24ad92b56299: Waiting
4eab4d25c303: Waiting
e2dd6cf79115: Waiting
67ecfc9591c8: Waiting
unauthorized: authentication required