How to pull base image from private artifactory?

7/6/2021

The task is to pull base image from private artifactory repo rather than docker hub due to rate limiting issue.

In the gitlab-ci.yml file I have mentioned base image like

image: artifactory.***.com/artifactory/aie-docker-dev-mydockerrepo:latest

But I am getting unauthorized error which might be because to pull this image I am still not logged into the repo.

My error :

WARNING: Failed to pull image with policy "": image pull failed: rpc error: code = Unknown desc = Error response from daemon: unauthorized

My question is Am I specifying the correct way to mention image? And where should I try to login in the gitlab file to pull the base image from Artifactory rather than docker hub.

P.S currently I am able to pull image from docker hub and pushing it to my private repository so credentials are working fine.

My gitlab file

image: artifactory.bayer.com/artifactory/aie-docker-dev-mydockerrepo:latest

services:  
 
  - name: docker:18.09.7-dind  
    entrypoint: ["env", "-u", "DOCKER_HOST"]  
    command: ["dockerd-entrypoint.sh"]  
  
variables:  
  DOCKER_AUTH_CONFIG: $DOCKER_AUTH_CONFIG

  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: ""
  Task: build
  Repo: iz-sai-eu
  Tag: latest
  Country: test


before_script:
  - apk --no-cache add curl
  - apk --no-cache add bash
  - docker login $ARTIFACTORY_URL -u $QA_ARTIFACTORY_USER -p $QA_ARTIFACTORY_ACCESS_TOKEN

stages:
  - build
  - tag-dev
  - deploy-qa

build:
  stage: build
  only:
    - Artifactory_Test
    - merge_requests
  tags:
    - arte
  script:
    - echo 'in build stage'
    - source scripts/dev_build.sh

  allow_failure: false
-- Laster
artifactory
docker
gitlab
kubernetes

0 Answers