-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
Description
Binding a volume into a target path containing a colon (:
) appears to be a missing feature. If it is possible then it's not documented. While colons are less common they have always been valid in a *nix path and are a plain old US ASKII character present on (almost?) every keyboard around the world.
There's some discussion in #12553 discussing this as a bug. But what I'm actually stuck with is the apparently missing feature. The workaround discussed in the bug ticket only applies to bind mounts by setting create_host_path
. But what I'm looking for is a way to do the same for type: volume
.
This is something that is possible via docker itself:
docker volume crete foo
docker run -it --rm --mount type=volume,src=foo,dst=/foo/bar:baz ubuntu
This ought to then be possible via docker compose.
As one hard example: I ran into this trying to emulate some google cloud behaviour for local testing. Google Cloud SQL will bind mount a postgres socket file into the container at something like: /cloudsql/bar-baz:europe-west4:foo-db-1234567890.
This simplest way to achieve this should be to mount a single volume into two containers:
/var/run/postgresl
in the postgres container/cloudsql/bar-baz:europe-west4:foo-db-1234567890
in the app container
The existence of colons in the path here is non-negotiable. I don't get to chose how google Cloud SQL works, and I do need to test that app code correctly handles connecting to this postgres socket despite the existence of colons in the DSN/URL