跳到主要内容

Woodpecker 提供在 YAML 中定义 Docker 卷的能力。您可以使用此参数将主机机器上的文件或文件夹挂载到您的容器中。

备注

卷仅对受信任的仓库可用,并且出于安全原因应仅在私有环境中使用。请参阅项目设置以启用受信任模式。

 steps:
- name: build
image: docker
commands:
- docker build --rm -t octocat/hello-world .
- docker run --rm octocat/hello-world --test
- docker push octocat/hello-world
- docker rmi octocat/hello-world
volumes:
+ - /var/run/docker.sock:/var/run/docker.sock

如果您使用 Docker 后端,您也可以使用命名卷,如 some_volume_name:/var/run/volume

请注意,Woodpecker 在主机机器上挂载卷。这意味着您在配置卷时必须使用绝对路径。尝试使用相对路径将导致错误。

-volumes: [ ./certs:/etc/ssl/certs ]
+volumes: [ /etc/ssl/certs:/etc/ssl/certs ]