Description
When a compose project service uses a volume with the subpath: option as documented, the service fails with a confusing invalid mode error.
Reproduce
-
Create the following compose project:
# mkdir -pv /tmp/foo/qux
mkdir: created directory '/tmp/foo'
mkdir: created directory '/tmp/foo/qux'
# touch /tmp/foo/qux/bah.txt
# cat /tmp/foo/docker-compose.yml
volumes:
foo_volume:
driver: "local"
driver_opts:
type: "none"
o: "bind"
device: "/tmp/foo"
services:
bar-service:
image: "ubuntu"
command: "ls -alR /tmp/foo/"
volumes:
- type: "volume"
source: "foo_volume"
target: "/tmp/foo"
volume:
subpath: "qux"
-
Note the resulting error when run:
# docker compose down --remove-orphans -v && docker compose up
[+] Running 3/3
✔ Container foo-bar_service-1 Removed 0.1s
✔ Volume foo_foo_volume Removed 0.0s
✔ Network foo_default Removed 0.9s
[+] Running 2/3
✔ Network foo_default Created 0.3s
✔ Volume "foo_foo_volume" Created 0.1s
⠼ Container foo-bar-service-1 Creating 0.3s
Error response from daemon: invalid mode: rw,qux
Expected behavior
The subpath from the volume should be mounted inside the serive's container.
docker version
Client: Docker Engine - Community
Version: 26.1.3
API version: 1.45
Go version: go1.21.10
Git commit: b72abbb
Built: Thu May 16 08:33:29 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.1.3
API version: 1.45 (minimum version 1.24)
Go version: go1.21.10
Git commit: 8e96db1
Built: Thu May 16 08:33:29 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.32
GitCommit: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
# docker info >./docker-info.log
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
# cat ./docker-info.log
Client: Docker Engine - Community
Version: 26.1.3
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.0
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 34
Running: 33
Paused: 0
Stopped: 1
Images: 38
Server Version: 26.1.3
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: cgroupfs
Cgroup Version: 1
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 nvidia runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 5.15.153.1-microsoft-standard-WSL2
Operating System: Pop!_OS 22.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.31GiB
Name: library.moodysalonnet
ID: 930e1cc3-4d06-44a2-828b-b203b25ad7a9
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Diagnostics ID
N/A
Additional Info
No *diagnose* tool is available from this installation:
# aptitude search -F '%p' ~i~ndocker
docker-buildx-plugin
docker-ce
docker-ce-cli
docker-ce-rootless-extras
docker-compose-plugin
nvidia-docker2
# aptitude search -F '%p' '~i~ndocker' | xargs -d '\n' -- dpkg -L | grep 'diagnose'
Description
When a compose project service uses a volume with the
subpath:option as documented, the service fails with a confusinginvalid modeerror.Reproduce
Create the following compose project:
Note the resulting error when run:
Expected behavior
The subpath from the volume should be mounted inside the serive's container.
docker version
Client: Docker Engine - Community Version: 26.1.3 API version: 1.45 Go version: go1.21.10 Git commit: b72abbb Built: Thu May 16 08:33:29 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 26.1.3 API version: 1.45 (minimum version 1.24) Go version: go1.21.10 Git commit: 8e96db1 Built: Thu May 16 08:33:29 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.32 GitCommit: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0docker info
Diagnostics ID
N/A
Additional Info
No
*diagnose*tool is available from this installation: