docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 291 forks source link

Bind mount in Docker Service doesn't work - MappedDirectories, HostPath property #1673

Closed lukaszherman closed 6 years ago

lukaszherman commented 6 years ago

I'm trying to create docker service with hub/registry on swarm farm.

mkdir D:\DockerHub
docker service create --name hub --mount type=bind,source=D:\DockerHub,target=C:\registry --publish mode=host,published=5000,target=5000 --mode global stefanscherer/registry-windows:2.6.2

Error: ujtmg2ny37229v1oi1dkltc58 hub.hacx7c5l7vqpbpm0tlofwlpue stefanscherer/registry-windows:2.6.2@sha256:1c191900be1fe8b24851b20ba699d1a8d4bed813678529ec4d27691a1c8bc41a DUSI-DOCKER01 Shutdown Failed 4 seconds ago "starting container failed: container a3bc444d7c661108655c0de215b204046a75090c6bea097736a30477690ca331 **encountered an error during CreateContainer: failure in a Windows system call: The request is not supported. (0x32)** extra info: {"SystemType":"Container","Name":"a3bc444d7c661108655c0de215b204046a75090c6bea097736a30477690ca331","Owner":"docker","IsDummy":false,"VolumePath":"\\\\?\\Volume{6053badb-b0b5-4950-a726-044b93ff6da6}","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"D:\\DockerImages\\windowsfilter\\a3bc444d7c661108655c0de215b204046a75090c6bea097736a30477690ca331","Layers":[{"ID":"e68d2f8c-a2ef-51cd-aaa1-ac248eb8a3b1","Path":"D:\\DockerImages\\windowsfilter\\5dfe736a0c244eddfe6b782c2b170be92ac27f764086389cad9b997e91993b5f"},{"ID":"6f297d2c-3fef-5273-bdee-c951f1a3717d","Path":"D:\\DockerImages\\windowsfilter\\65ebf5ff8a8a314e200dbb67aff4b2f0a96d064e5730c0e177567b508f6816b8"},{"ID":"79a0af35-e24b-5cb9-8114-aa30d98dbf34","Path":"D:\\DockerImages\\windowsfilter\\5ab2596074651ad12d6c488beaee52f94610d586d5fad2595db5b08ac475fb1b"},{"ID":"37cd5414-13fb-565d-8767-b39f4ca9070e","Path":"D:\\DockerImages\\windowsfilter\\0c751b1d41be96d8a65d5e225859290c10574b3a1e8a1e983f05df1a5b1021ee"},{"ID":"22e772ef-772b-5211-bd9e-54b347717632","Path":"D:\\DockerImages\\windowsfilter\\9a1490348f05e3c70307995d60289188ddf3b6cfe476d9be8687df455cad40d3"},{"ID":"09034e03-8db5-5feb-9bf8-4a612bca1a16","Path":"D:\\DockerImages\\windowsfilter\\fa98dc34b1c4dab74cab6b6603da42efb32c4ef10d3ce3bfe2d63138e3df20fb"},{"ID":"fb88c34d-85af-56b7-83c3-68fd0034ec6d","Path":"D:\\DockerImages\\windowsfilter\\e5b0eeb87a39ef579898e3a9a1164fe207f11031fc2238b3f92db5531e2e3754"},{"ID":"396553c0-5e59-5e89-8c46-4b522b859459","Path":"D:\\DockerImages\\windowsfilter\\2b43ae12d015e52f054e70999f276836757cc892c25ba8ed15630861269b787f"}],"HostName":"a3bc444d7c66","MappedDirectories":[{**"HostPath":"D:\\DockerHub","ContainerPath":"C:\\registry"**,"ReadOnly":false,"BandwidthMaximum":0,"IOPSMaximum":0},{"**HostPath":"D:\\DockerImages\\volumes\\be543c1be976ac6f962c46c0d4bf914e2b89324faff98b3e2818228a4153083b\\_data","ContainerPath":"c:\\registry**","ReadOnly":false,"BandwidthMaximum":0,"IOPSMaximum":0}],"HvPartition":false,"EndpointList":["8764043a-af0a-4f9d-bb73-a73d6e64ec73"],"Servicing":false,"AllowUnqualifiedDNSQuery":true}"

If I change C:\registry to C:\registryWrong then container starts but it's using it's local storage.

There is no problem with first command if I run it as standard container (outside swarm). mkdir D:\DockerHub docker run -d -p 5000:5000 --restart=always --name registry -v D:\DockerHub:C:\registry stefanscherer/registry-windows:2.6.2

It looks like it's not overwriting HostPath property.

MappedDirectories":[ {"HostPath":"D:\DockerHub","ContainerPath":"C:\registry","ReadOnly":false,"BandwidthMaximum":0,"IOPSMaximum":0}, {"HostPath":"D:\DockerImages\volumes\be543c1be976ac6f962c46c0d4bf914e2b89324faff98b3e2818228a4153083b\_data","ContainerPath":"c:\registry","ReadOnly":false,"BandwidthMaximum":0,"IOPSMaximum":0} ]

docker version
Client:
 Version:      17.06.2-ee-6
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   e75fdb8
 Built:        Mon Nov 27 22:46:09 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.06.2-ee-6
 API version:  1.30 (minimum version 1.24)
 Go version:   go1.8.3
 Git commit:   e75fdb8
 Built:        Mon Nov 27 22:55:16 2017
 OS/Arch:      windows/amd64
 Experimental: false
lukaszherman commented 6 years ago

Found It! The size of letters is important. There should be "c:\registry" instead of "C:\registry".

mkdir D:\DockerHub
docker service create --name hub --mount type=bind,source=D:\DockerHub,target=c:\registry --publish mode=host,published=5000,target=5000 --mode global stefanscherer/registry-windows:2.6.2
docker-robott commented 4 years ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked