0


问题:需要添加一些行(例如:124.343.23.34 gitlab.example.com)到 /etc/hosts 以用于 dind(docker in docker)。
gitlab-ci.yml 中的所有内容
当前脚本:

cache:build:
  stage: cache
  image: docker:dind
  services:
    - redis:latest
    - docker:dind
  tags:
    - docker
  cache:
    <<: *cache_build
    policy: pull-push
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
    - docker pull $DOCKER_DEV_IMAGE
    - docker pull node:current-alpine
    - docker run --rm -v $(pwd):/var/www -w /var/www $DOCKER_DEV_IMAGE composer install -n
    - docker run --rm -v $(pwd):/var/www -w /var/www $DOCKER_DEV_IMAGE bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
    - docker run --rm -v $(pwd):/var/www -w /var/www node:current-alpine yarn install
    - docker run --rm -v $(pwd):/var/www -w /var/www node:current-alpine yarn prod
4

1 回答 1

0

您是否尝试过使用该--add-host选项?详见https://www.thegeekdiary.com/how-to-add-new-host-entry-in-etc-hosts-when-a-docker-container-is-run/

于 2020-04-29T16:40:55.453 回答