support docker run --mount flag

Description

I'm using docker in this way to run a full systemd-enabled container. https://dev.to/dholth/how-to-use-docker-instead-of-virtualbox-on-osx-without-changing-the-world-4ack

In the blog post --tmpfs and -v (volume) are used, but --mount can replace both of those flags. The --mount flag is recommended by the docker docs.

"The --mount flag allows you to mount volumes, host-directories and tmpfs mounts in a container." https://docs.docker.com/engine/reference/commandline/run/#add-bind-mounts-or-volumes-using-the---mount-flag

Proposal

The [runners.docker] section has a parameter:

volumes Specify additional volumes that should be mounted (same syntax as Docker’s -v flag)

Add a similar parameter:

mounts Specify additional mounts that should be added (same syntax as Docker’s --mount flag)

Uses

Provides gitlab-runner a possibility to create a docker-volume on-the-fly with the necessary NFS options?

export NFS_VOL_NAME=mynfs NFS_LOCAL_MNT=/mnt/mynfs NFS_SERVER=my.nfs.server.com NFS_SHARE=/my/server/path NFS_OPTS=vers=4,soft

docker volume create --driver local \
  --opt type=nfs --opt o=addr=$NFS_SERVER,$NFS_OPTS \
  --opt device=:$NFS_SHARE $NFS_VOL_NAME
Edited Oct 23, 2020 by Steve Xuereb
Assignee Loading
Time tracking Loading