0
votes

do I have here a misconfigure in my .yml?

pushing docker image but an error occurred:

denied: requested access to the resource is denied

.gitlab-ci.yml

image: docker:latest

services:
  - docker:dind
  - mysql:5.7

dockerhub:
  stage: deploy
  script:
    - docker build --pull -t $CI_REGISTRY/marjose/evotingsystem -f Dockerfile .
    - docker login -u evotesys -p $CI_BUILD_TOKEN $CI_REGISTRY
#    - docker run registry.gitlab.com/marjose/evotingsystem
    - docker push $CI_REGISTRY/marjose/evotingsystem:latest
  only:
    - master


variables:
  MYSQL_DATABASE: homestead
  MYSQL_ROOT_PASSWORD: secret
  DB_HOST: mysql
  DB_USERNAME: root

stages:
  - test
  - deploy

unit_test:
  stage: test
  script:
    - cp .env.example .env
#    - php artisan key:generate
#    - php artisan migrate
#    - vendor/bin/phpunit

expected to push the image on my gitlab registry container.

1
Which command results in that error ? - marcolz
denied: requested access to the resource is denied - MarJose

1 Answers

0
votes

Not sure the CI_BUILD_TOKEN is same as CI_REGISTRY_PASSWORD and evotesys will be same as CI_REGISTRY_USER

I directly run below command, it works

docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY

Second, adjust the docker image, reference: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html

image: docker:19.03.1

services:
  - docker:19.03.1-dind
  - mysql:5.7