Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker GitLab CI Runner,如何在服务容器中使用卷或装载_Docker_Gitlab Ci Runner - Fatal编程技术网

Docker GitLab CI Runner,如何在服务容器中使用卷或装载

Docker GitLab CI Runner,如何在服务容器中使用卷或装载,docker,gitlab-ci-runner,Docker,Gitlab Ci Runner,我使用GitLab CI Runner,它使用以下命令: docker run -d --name postgres postgres:9.4 我想这样做: docker run -d --name postgres --volumes-from postgres_datastore postgres:9.4 但是GitLab CI Runner不支持任何选项(-v或--volumes from) 还有其他方法吗?Gitlab CI Runner中尚未提供Docker卷自选项(请参见此),但

我使用GitLab CI Runner,它使用以下命令:

docker run -d --name postgres postgres:9.4
我想这样做:

docker run -d --name postgres --volumes-from postgres_datastore postgres:9.4
但是GitLab CI Runner不支持任何选项
(-v或--volumes from)


还有其他方法吗?

Gitlab CI Runner中尚未提供Docker
卷自
选项(请参见此),但是您可以配置主机装载和卷:

[runners.docker]
  volumes = ["/host/path:/target/path:rw", "/some/path"]
上面的示例将在容器内的
/target/path/
处装载
/host/path
,并在
/some/path
处创建一个新的卷容器

有关所有docker相关选项,请参见Gitlab CI Runner

编辑


对于服务容器,似乎只能通过服务映像的dockerfile定义卷。根据您的要求,可能已经足够了。

您的示例将挂载路径放在general runner容器内(而不是带有postgres服务的容器)。正确,您的问题有点误导。我更新了标题和答案,希望现在更清楚。