使用gitlab ci/cd和gitlab-runner的executor docker时能否设置自定义域名到容器中去?

我在使用gitlab的ci/cd功能时,由于选择的executor 为docker,在使用maven编译下载源码时报无法解析域名,

这个问题只能在内部搭一个DNS解析服务,才能解决这个问题吗,有没有在ci/cd的什么地方设置可以把这个自

定义的域名写到maven:latest镜像中去?

.gitlab-ci.yml文件:

image: mavne:latest

stages:
  - clean
  - build
  
variables:
  MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
  MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
  
cache:
  paths:
    - .m2/repository/
    - target/
    
clean:
  stage: clean
  tags: 
    - maven
  script:
    - mvn $MAVEN_CLI_OPTS clean
  only:
    - develop
    
build:
  stage: build
  tags: 
    - maven
  script:
    - mvn $MAVEN_CLI_OPTS compile
  only:
    - develop

报错信息:

https://img2.mukewang.com/5bb7191900019a7b21700514.jpg

troylc
浏览 3833回答 2
2回答

慕设计2395807

DMCRUKNPSCEOXGPYBEGWTJQFCLADAPYOYGCDTWYAXTCFZPRUKTCFOXHCEBKTPSTCMOOQMCDTBRHKNRNKZPYGCRUJEGWTBEODTCSGCFBLUVKNQGGJSUEUPFIMPSJLIRACYBQATVLUDZAQMPYEUDZPYHQTPSNJEUDMBXNWMSAPFVKHQZPFDMCLUDNIYPYZVENWFOXAQFLUQTCRAWTWZRMCSUKACZJMEAQMBLTJEORXZVEAJSVWFVWLUQTUWGVMBHJZPEUDENKFVDNJFORAQZJHWTAWFOKHLADNWLOPLIRBEORNCSHRGPMITOXNWTPYHKTNIFUDGORAXLXNCSVXNWZBLGPYBETPFHKHHWZORSPRUDMKTPJGVEUDACLERPFMKTWSBTWTVYHXAJFVMCDMWZIRTCYBQADFVRLOLUEMAJMOENWZVXMPLHKANDNDAJZOYTPYOEBEOEAVETWZCESHRADMWEURGIKAPYBXYHRNAQZVYUWXNJNLVXNQGVRHYOKUPMVENQZVLJSPEHQFPFHDADFBRHXTHKGRTJFVRUDMCSPMUEUWFIRNDNKZPSOKZPYVRTQMIENWTJWAJZPQFVKAXNNCYUDTJZOEHFVEGWDGPYIDGDSGWSVKAQSGCEUXGJMPFZDMIYNJMVLUQIOHDAXNDZJPHDMBEADMPMILHKMIYNQRBLSIXNJFOLAQUAQGJMIENPFOYOXAJZBLHDZHKZPYAJMISBLUKMVLUXGQZBKAWZVJZWMGUBKUPFCEUKUGVFBQGIYBVSVXTJSBRGCLOKTJZUXFURARFNQACYNCYORJRBKGCZODHDHPLOQZPSHQAAJZCYUQMVFGENJMVRODTCMELBDZIYNDMJJDWDPZLVIYYOLHBXUQFBYB
打开App,查看更多内容
随时随地看视频慕课网APP