gpt4 book ai didi

continuous-integration - 在 drone.io 上使用 dind

转载 作者:行者123 更新时间:2023-12-02 06:50:21 24 4
gpt4 key购买 nike

我正在尝试从 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

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

最佳答案

您可以使用服务部分来启动 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' ]

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

command: [ '-H', 'unix:///drone/docker.sock' ]

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

privileged: true

关于continuous-integration - 在 drone.io 上使用 dind,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46366271/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com