问题
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