supra@test140:~/test.subpath$ sudo docker volume create test123
test123
supra@test140:~/test.subpath$ sudo docker run -d --name nginx-subpath --mount type=volume,source=test123,destination=/supra/www nginx
5828c2d578b3cd9ee6c84abc048333eaa066f47c6d554c98837ac171560c7c4f
supra@test140:~/test.subpath$ sudo docker exec -it nginx-subpath bash
root@5828c2d578b3:/# mkdir /supra/www/subpath
root@5828c2d578b3:/# echo "hello, world!" > /supra/www/subpath/hello
root@5828c2d578b3:/# exit
exit
supra@test140:~/test.subpath$ sudo docker exec -it nginx-subpath cat /supra/www/subpath/hello
hello, world!
supra@test140:~/test.subpath$ sudo docker rm nginx-subpath --force
nginx-subpath
supra@test140:~/test.subpath$ sudo docker run -d --name nginx-subpath --mount type=volume,source=test123,destination=/supra/www,volume-subpath=s
ubpath nginx
fba1b8e309900211be8b3b8381fd81bdf6c13ccd5553aa0394e179e999ac47b8
supra@test140:~/test.subpath$ sudo docker exec -it nginx-subpath cat /supra/www/hello
hello, world!
supra@test140:~/test.subpath$ sudo docker rm nginx-subpath --force
nginx-subpath
supra@test140:~/test.subpath$ sudo docker service create --name nginx-subpath --mount type=volume,source=test123,destination=/supra/www,volume-o
pt=volume-subpath=subpath nginx
re8616r9smrg65gc8y3wnibc5
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service re8616r9smrg65gc8y3wnibc5 converged
supra@test140:~/test.subpath$ sudo docker ps | grep nginx-subpath
2b364c693bd5 nginx:latest "/docker-entrypoint.…" 51 seconds ago Up 50 seconds 80/tcp nginx-
subpath.1.qti4x2n1mm3f6dchkz45jou9z
supra@test140:~/test.subpath$ sudo docker exec 2b364c693bd5 ls /supra/www
subpath
supra@test140:~/test.subpath$ sudo docker inspect 2b364c693bd5
...
"HostConfig": {
"Mounts": [
{
"Type": "volume",
"Source": "test123",
"Target": "/supra/www",
"VolumeOptions": {
"DriverConfig": {
"Options": {
"volume-subpath": "subpath"
}
}
}
}
],
...
}
...
"Mounts": [
{
"Type": "volume",
"Name": "test123",
"Source": "/var/lib/docker/volumes/test123/_data",
"Destination": "/supra/www",
"Driver": "local",
"Mode": "z",
"RW": true,
"Propagation": ""
}
],
...
supra@test140:~/test.subpath$
Description
with the latest v26.0.0, volume-subpath does not work for docker service.
When creating a docker service, volume-subpath can be properly set, but the corresponding docker container cannot make use of it.
Reproduce
please check the attached stdout for detailed info.
docker_subpath.txt
Details
Expected behavior
volume-subpath works for docker service that subpath setting is effective for the corresponding container
docker version
Client: Docker Engine - Community Version: 26.0.0 API version: 1.45 Go version: go1.21.8 Git commit: 2ae903e Built: Wed Mar 20 15:17:48 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 26.0.0 API version: 1.45 (minimum version 1.24) Go version: go1.21.8 Git commit: 8b79278 Built: Wed Mar 20 15:17:48 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.28 GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0docker info
Additional Info
No response