Docker Community Forums

Share and learn in the Docker community.

Can not pull/push image from/to private docker registry from GitlabCI


(Dungnt081191) #1

Hi ,
in my situation , i using Registry:2 from docker Hub to make this is Private Docker Registry for my own and expose to example URL : registry.docker:5000.
Beside that , i used Gitlab CI ( gitlab-ci.yml) to run CI to build an image to ship code inside them.
It’s okay when build image but when push custom image to private docker registry below , GitlabCI is always FAIL.

How Gitlab work with Docker private registry?

i just test login private registry in Gitlab-CI:

deployimage:
stage: deploy
services:
- docker:dind
variables:
DOCKER_HOST: tcp://registry.docker:5000
script:
- docker login $DOCKER_HOST -u myuser -p $pwd

gitlab-runner log:
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Warning: failed to get default registry endpoint from daemon (error during connect: Get http://registry.docker:5000/v1.38/info: dial tcp: lookup registry.docker on 172.x.x.x: no such host). Using system default: https://index.docker.io/v1/
error during connect: Post http://registry.docker:5000/v1.38/auth: dial tcp: lookup registry.sharinggc on 172.x.x.x:53: no such host
ERROR: Job failed: exit code 1