卷
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 ]