I have mounted my google drive folder in Ubuntu using gnome-online-accounts
, which ends up being mounted like so:
/run/user/1000/gvfs/google-drive:host=my_host,user=my.username
Mounting this in a docker container works fine if I escape it correctly, i.e.:
--mount "type=bind,\"source=/run/user/1000/gvfs/google-drive:host=my_host,user=my.username/\",target=/data/gdrive"
If I try to do the same with docker compose, however, it breaks:
# docker-compose.yml
services:
myservice:
build:
context: .
dockerfile: Dockerfile
volumes:
- type: bind
source: "\"/run/user/1000/gvfs/google-drive:host=my_host,user=my.username/\""
target: /data/gdrive
I get the error:
Error response from daemon: invalid volume specification: '/home/me/my_project/"/run/user/1000/gvfs/google-drive:host=my_host,user=my.username/":/data/gdrive:rw'
What confuses me even more is that it somehow prefixes the mount with the path to the project I'm working in...
I've also tried not escaping it and escaping it with source: |
and source: >
, but to no avail.
I have mounted my google drive folder in Ubuntu using gnome-online-accounts
, which ends up being mounted like so:
/run/user/1000/gvfs/google-drive:host=my_host.com,user=my.username
Mounting this in a docker container works fine if I escape it correctly, i.e.:
--mount "type=bind,\"source=/run/user/1000/gvfs/google-drive:host=my_host.com,user=my.username/\",target=/data/gdrive"
If I try to do the same with docker compose, however, it breaks:
# docker-compose.yml
services:
myservice:
build:
context: .
dockerfile: Dockerfile
volumes:
- type: bind
source: "\"/run/user/1000/gvfs/google-drive:host=my_host.com,user=my.username/\""
target: /data/gdrive
I get the error:
Error response from daemon: invalid volume specification: '/home/me/my_project/"/run/user/1000/gvfs/google-drive:host=my_host.com,user=my.username/":/data/gdrive:rw'
What confuses me even more is that it somehow prefixes the mount with the path to the project I'm working in...
I've also tried not escaping it and escaping it with source: |
and source: >
, but to no avail.
1 Answer
Reset to default 0I've also asked in the docker forum, and it looks like you need to create a name volume to get this to work:
services:
my_service:
...
volumes:
- gdrive:/data/gdrive
volumes:
gdrive:
driver: local
driver_opts:
type: none
o: bind
device: "/run/user/1000/gvfs/google-drive:host=my_host.com,user=my.username/"
source:
value? I can see Compose getting confused by the path not starting exactly with a/
character and then believing it's a relative path. – David Maze Commented Feb 7 at 16:27Error response from daemon: invalid volume specification: '/run/user/1000/gvfs/google-drive:host=my_host.com,user=my.user/:/data/gdrive:rw'
– Samuel Neugber Commented Feb 7 at 17:36external
in the docker compose file:docker volume create \ --driver local \ -o o=bind \ -o type=none \ -o device=/var/app/data \ example-volume
from here: til.hashrocket.com/posts/… – Samuel Neugber Commented Feb 7 at 19:34