Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Bind mount with paths containing colons : not working #12553

Closed
tobiasdam opened this issue Feb 12, 2025 · 4 comments
Closed

[BUG] Bind mount with paths containing colons : not working #12553

tobiasdam opened this issue Feb 12, 2025 · 4 comments

Comments

@tobiasdam
Copy link

Description

When trying to bind mount a directory in a container that contains a colon in the path (like /a:b) using the long syntax, the creation of the container fails.
docker compose up -d show following error message:

Error response from daemon: invalid volume specification: '/home/pi/a:b:/b:a:rw'

The same docker-compose.yaml works fine using docker compose version 2.29.7, but throws the error when using version 2.30.3 or 2.32.4

Steps To Reproduce

  1. Create docker-compose.yaml:
services:
  test:
    image: alpine
    volumes:
      - type: bind
        source: "/home/pi/a:b"
        target: "/b:a"
  1. run with docker compose up -d

Compose Version

Not working:
- Docker Compose version v2.32.4
- Docker Compose version v2.30.3

Working:
- Docker Compose version v2.29.7

Docker Environment

Client: Docker Engine - Community
 Version:    27.5.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.20.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 52
  Running: 15
  Paused: 0
  Stopped: 37
 Images: 125
 Server Version: 27.5.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.21-v8+
 Operating System: Raspbian GNU/Linux 11 (bullseye)
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 7.629GiB
 Name: lorabridgegateway
 ID: YRAM:VOXS:V6J3:J7T7:VGRC:RXDG:345G:EFUV:RER4:27L4:KXP3:BQ5E
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support

Anything else?

No response

@ndeloof
Copy link
Contributor

ndeloof commented Feb 13, 2025

Unfortunately, even you're using the long syntax, we have to use the Docker Engine Bind API as the (more recent) Mount API is not strictly equivalent. This API requires we re-create the short syntax volume bind definition, and use of : makes it ambiguous.

@ndeloof
Copy link
Contributor

ndeloof commented Feb 13, 2025

As a workaround, you can set create_host_path: false in volume declaration, to force compose switch to the Mount API

@tobiasdam
Copy link
Author

I see, thank you for the workaround! Maybe mentioning this as a note in the docs would be helpful to others as well.

@ndeloof
Copy link
Contributor

ndeloof commented Feb 14, 2025

This is an implementation detail and something we want to fix at some point (there are some blockers we need to address first) so documenting this would bring confusion (most users don't know engine has 2 APIs for the same purpose) and would depend on compose/engine version in use 🤨
As using colons in a path is uncommon corner-case, I prefer to close this issue as "not planned"

@ndeloof ndeloof closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants