GitLab CI Runner, how to use volumes or mounts in service containers

青春壹個敷衍的年華 提交于 2019-12-10 13:33:33

问题


I use GitLab CI Runner, it uses the command:

docker run -d --name postgres postgres:9.4

I want to do something like this:

docker run -d --name postgres --volumes-from postgres_datastore postgres:9.4

But GitLab CI Runner doesn't support any options (-v or --volumes-from).

Is there any other way?


回答1:


The Docker volumes-from option is not yet available in Gitlab CI Runner (see this PR), however you can configure host mounts and volumes:

[runners.docker]
  volumes = ["/host/path:/target/path:rw", "/some/path"]

The above example would mount /host/path at /target/path/ inside the container and also create a new volume container at /some/path.

See the Gitlab CI Runner manual for all docker related options.

Edit:

For service containers it seems you can only define volumes via the dockerfile of the service image. Maybe enough depending on your requirements.



来源:https://stackoverflow.com/questions/36598197/gitlab-ci-runner-how-to-use-volumes-or-mounts-in-service-containers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!