Access denied When push to registry

Why I can’t push to registry? I get a message

unauthorized: HTTP Basic: Access denied
ERROR: Job failed: exit status 1

I write in terminal

docker login registry.gitlab.com

and after trying to push.
Runner installed as Shell.

.gitlab-ci.yml
    image: docker:latest
    stages:
      - build_image
    build:
      stage: build_image
      script:
        - docker build -t $CI_REGISTRY_IMAGE .
        - docker push $CI_REGISTRY_IMAGE

Please check https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#authenticating-to-the-container-registry

docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY before docker push might work

1 Like