在drone.io上使用dind

Fáb*_*ro 2 continuous-integration drone.io drone

我正在尝试从gitlab ci转到drone.io.但我不能让DIND在gitlab上运行良好.以上是我在gitlab上的表现.

variables:
  NODE_ENV: 'test'
  DOCKER_DRIVER: overlay

image: gitlab/dind

services:
  - docker:dind

cache:
  untracked: true

stages:
  - test

test:
  stage: test
  before_script:
    - docker info
    - docker-compose --version
    - docker-compose pull
    - docker-compose build
  after_script:
    - docker-compose down
  script:
    - docker-compose run --rm api yarn install
Run Code Online (Sandbox Code Playgroud)

如何创建等效的无人机文件?

Bra*_*ski 8

您可以使用services部分启动docker守护程序.

pipeline:
  ping:
    image: docker
    environment:
      - DOCKER_HOST=unix:///drone/docker.sock
    commands:
      - sleep 10 # give docker enough time to initialize
      - docker ps -a

services:
  docker:
    image: docker:dind
    privileged: true
    command: [ '-H', 'unix:///drone/docker.sock' ]
Run Code Online (Sandbox Code Playgroud)

请注意,我们更改了docker套接字的默认位置,并写入管道中所有容器共享的无人机卷:

command: [ '-H', 'unix:///drone/docker.sock' ]
Run Code Online (Sandbox Code Playgroud)

另请注意,我们需要以特权模式运行dind容器.特权标志只能由受信任的存储库使用.因此,您需要用户管理员在无人机用户界面中为您的存储库设置可信标志为true.

privileged: true
Run Code Online (Sandbox Code Playgroud)