Search code examples
dockergitlabgitlab-cigitlab-ci-runner

Gitlab-runner: pull access denied for, repository does not exist or may require 'docker login': denied: requested access to the resource is denied


I am new to gitlab-runner and docker. I am trying to automate my project using CI/CD pipelines. I am referring to this article. (But I have modified Dockerfile and setup.sh a bit as the post is too old hence some of the things were not working or were deprecated).

And I am getting this error in my gitlab pipeline:

Running with gitlab-runner 15.4.0 (43b2dc3d)
  on Generic debian wheezy package build runner r1Z1sTLv
Preparing the "docker" executor
Using Docker executor with image generic-package-build-runner:v1 ...
Pulling docker image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:arm64-43b2dc3d ...
Using docker image sha256:b7934566c48e2f47719fe08bbfb89d92b8ad4181ffdc6592f2a25cefab0c284e for registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:arm64-43b2dc3d with digest registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper@sha256:358a57cd8617424239fcfdffd9a47ebca6e72d0dc940c223af2cec95c77f9bbd ...
Pulling docker image generic-package-build-runner:v1 ...
WARNING: Failed to pull image with policy "always": Error response from daemon: pull access denied for generic-package-build-runner, repository does not exist or may require 'docker login': denied: requested access to the resource is denied (manager.go:235:3s)
ERROR: Job failed: failed to pull image "generic-package-build-runner:v1" with specified policies [always]: Error response from daemon: pull access denied for generic-package-build-runner, repository does not exist or may require 'docker login': denied: requested access to the resource is denied (manager.go:235:3s)

I have used this command to make docker image:

docker build -t generic-package-build-runner:v1 .

I used this command to register the gitlab-runner

gitlab-runner register \
--non-interactive \
--url "SOMEURL" \
--registration-token "SOMETOKEN" \
--description "Generic debian wheezy package build runner" \
--executor "docker" \
--docker-image "generic-package-build-runner:v1"

where I have replaced SOMEURL and SOMETOKEN with actual placeholders.

My docker files is:

FROM dockette/wheezy
ADD  setup.sh /opt/  
RUN  /bin/bash /opt/setup.sh

setup.sh

deb http://archive.debian.org/debian wheezy main contrib non-free
deb http://archive.debian.org/debian-archive/debian-security/ wheezy/updates main contrib non-free
deb [arch=armhf] http://repos.rcn-ee.com/debian/ wheezy main
yes | apt-get update 
yes | apt-get --force-yes install git dh-make build-essential autoconf autotools-dev

gitlab-ci.yml

# Is performed before the scripts in the stage step
before_script:  
  - source /etc/profile
  - echo "Hello, $GITLAB_USER_LOGIN!"
  - echo "Hello, $GITLAB_USER_PASSWORD"
#  - sudo rm /var/cache/apt/archives/lock
#  - sudo rm /var/lib/dpkg/lock
#  - sudo su
#  - sudo -S su < $password_secret

# Defines stages which are to be executed
stages:  
  - build

# Stage "build"
run-build:  
  stage: build
  script:
#    - apt-get install -y libncurses5-dev libglib2.0-dev libgeoip-dev libtokyocabinet-dev zlib1g-dev libncursesw5-dev libbz2-dev
    - autoreconf -fvi
    - cp COPYING debian/copyright
    - dpkg-buildpackage -us -uc
    - mkdir build
    - mv ../goaccess*.deb build/

  # This stage is only executed for new tags
  only:
    - tags

  # The files which are to be made available in GitLab
  artifacts:
    paths:
      - build/*

Registered runner on Gitlab: enter image description here

Docker desktop: enter image description here

enter image description here


Solution

  • SO i reosolved it by pushing my image on docker hub after creating an account there and then it worked fine.