I’m pretty new to IBM Cloud and Code Engine. I am trying to deploy an app called "project1" by uploading a docker container to IBM Cloud Container Registry and using it for a Code Engine application.
The problem is, the app creation always fails with this message (the namespace is project_namespace):
"Revision "project1-00001" failed with message: Unable to fetch image "icr.io/project1_namespace/project1": failed to resolve image to digest: GET https:/. See https://ibm.biz/BdPKqq; Authorization required. See https://ibm.biz/BdPKqq."
or sometimes this message:
"Revision "project1-00001" failed with message: Unable to fetch image "icr.io/project1_namespace/project1": failed to resolve image to digest: GET https://icr.io/oauth/token?scope=repository%!A(MISSING)project1_namespace%!F(MISSING)project1%!A(MISSING)pull&service=registry: UNAUTHORIZED: Authorization required. See https://ibm.biz/BdPKqq; Authorization required. See https://ibm.biz/BdPKqq."
I don’t understand why authentication would be failing here. Here is what I do:
ibmcloud login
ibmcloud cr login
docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_PATH
ibmcloud target -g $RESOURCE_GROUP_NAME
ibmcloud cr namespace-add $REGISTRY_NAMESPACE
ibmcloud ce project create --name project1
ibmcloud ce project select -n project1
docker tag $DOCKER_IMAGE_NAME icr.io/$REGISTRY_NAMESPACE/${DOCKER_IMAGE_NAME}:latest
docker push icr.io/$REGISTRY_NAMESPACE/${DOCKER_IMAGE_NAME}:latest
ibmcloud ce app create --name $CODE_ENGINE_APP_NAME --image icr.io/$REGISTRY_NAMESPACE/$DOCKER_IMAGE_NAME
Code Engine application should pull the icr.io image sucessfully. Right?
2
Answers
I think you need to create a
registry access secret
in your Code Engine projectproject1
. Here are some of the useful links:IBM Cloud Code Engine needs access itself to the Container Registry, your namespace and the stored container images. In your commands, you showed that you login first (
cr login
), then access the container registry to add a namespace and push the image. It is your private registry with the containers only visible to those with access.Code Engine does not have any access to the Container Registry unless you grant it. That’s, why you need to create an access secret.