Can't Access Private MySQL Docker Image From Gitlab CI

自古美人都是妖i 提交于 2019-12-03 08:11:49

First thing is to setup GitLab CI to provide credentials of the private docker registry when needed. To do that there is specific section in docs you should follow, to be a complete answer that is

  1. Get docker registry url, username and password using docker login or some other manner (I had to spend sometime to figure out registry for the docker hub)
  2. Define DOCKER_AUTH_CONFIG varialbe in GitLab CI variable section it would look like

{ "auths":{ "registry.hub.docker.com":{ "auth":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx" // base 64 encoded username:password } } }

  1. Declare image/service image: registry.hub.docker.com/ruwanka/helloworld:0.1 in .gitlab-ci.yml

That should full fill the requirement of pulling images. There is another section in docs that lists the requirement of runner to allow list of services. If it doesn't specify any then it should be fine, you may have to tweak it if it doesn't work.

final yaml is look like below

image: registry.hub.docker.com/ruwanka/helloworld:0.1

build:
  script:
   - echo "hello"
# more steps   
services:
  - registry.hub.docker.com/ruwanka/helloworld:0.1

snippet of gitlab job's logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!