docker / docker/compose

Mounting a volume to a target containing a colon (:)

Open
#12,993 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/0-triage
Dominant language
Go
Stars
38.2k
Forks
5.8k
Avg merge
2d 14h
Merged PRs (30d)
55

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named in the issue. Start by tracing how Compose parses and handles type: volume mounts, using Docker's --mount example as the expected behavior. Done means a Compose configuration can mount the same volume at a target containing colons in both containers.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go
Domain
devops, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.