CI / Docker: Unable to find image locally
Summary
For some reason my Pipeline does not work anymore as expected even though I didn't change it. I'm using gitlab.com.
I'm suddenly getting Unable to find image 'registry.gitlab.com/[REPO_NAME]/stage:4fc9cae5' locally
My Pipeline looks like this:
image: docker:git
services:
- docker:dind
build stage:
only:
- stage
stage: build
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- cp -v $DOTENV_STAGE $CI_PROJECT_DIR/.env
- docker pull $GITLAB_IMAGE_PATH/$CI_COMMIT_BRANCH || true
- docker build --cache-from $GITLAB_IMAGE_PATH/$CI_COMMIT_BRANCH --file=Dockerfile-stage -t $GITLAB_IMAGE_PATH/$CI_COMMIT_BRANCH:$CI_COMMIT_SHORT_SHA -t $GITLAB_IMAGE_PATH/$CI_COMMIT_BRANCH:latest .
- docker push $GITLAB_IMAGE_PATH/$CI_COMMIT_BRANCH:latest
after_script:
- rm $CI_PROJECT_DIR/.env
test:
only:
- stage
stage: test
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker run --env-file $DOTENV_TEST $GITLAB_IMAGE_PATH/$CI_COMMIT_BRANCH:$CI_COMMIT_SHORT_SHA npm run test
The build process succeeds as expected, but the test doesn't because it cannot find the image with the :$CI_COMMIT_SHORT_SHA-tag.
$ docker run --env-file $DOTENV_TEST $GITLAB_IMAGE_PATH/$CI_COMMIT_BRANCH:$CI_COMMIT_SHORT_SHA npm run test
Unable to find image 'registry.gitlab.com/[REPO_NAME]/stage:4fc9cae5' locally
docker: Error response from daemon: manifest for registry.gitlab.com/[REPO_NAME]/stage:4fc9cae5 not found: manifest unknown: manifest unknown.
I don't want to use the latest-tag here since I want to make sure it's always referring to image with the commit-sha.
It used to work like this before, I didn't do any changes to my pipeline. Where there any changes made to the runner?
Steps to reproduce
- Run beforementioned pipeline
What is the current bug behavior?
Runner cannot find the built image
What is the expected correct behavior?
Runner finds the built image
Relevant logs and/or screenshots
See above
Output of checks
This bug happens on GitLab.com