我们已经成功地从Dockerfile部署到OpenShift,并可以通过以下方式验证其存在:
oc get is -n my-project
my-image-a image-registry.openshift-image-registry.svc:5000/my-project/my-image-a
我们想从另一个Dockerfile中引用这一点,比如:
FROM my-image-a
这导致:
Pulling image my-image- ...
Warning: Pull failed, retrying in 5s ...
Warning: Pull failed, retrying in 5s ...
Warning: Pull failed, retrying in 5s ...
error: build error: failed to pull image: After retrying 2 times, Pull image still failed due to
error: errors:
denied: requested access to the resource is denied
unauthorized: authentication required
我们如何进行身份验证?我们推送图像没有问题,但拉它不起作用。
您可以使用以下命令进行身份验证:
docker login -u $(oc whoami) -p $(oc whoami -t) registry-openshift-image-registry.apps.<your-cluster-host>