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

Container volumes - ContainerPath other than C: drive? #334

Closed
mwieczorek opened this issue Jul 8, 2016 · 7 comments
Closed

Container volumes - ContainerPath other than C: drive? #334

mwieczorek opened this issue Jul 8, 2016 · 7 comments

Comments

@mwieczorek
Copy link
Contributor

Is it possible to have other drives in container than C:?
If I run:

docker run -it -v d:\new-data-volume windowsservercore cmd

I get and error:

C:\Docker\docker.exe: Error response from daemon: container 
ad21aac97cd17479a596c302dfe8cb433f425789cc51ff3b5043815730a6ad39 encountered an error during CreateContainer failed in Win32: 
The parameter is incorrect. (0x57) extra info: 
{"SystemType":"Container","Name":"ad21aac97cd17479a596c302dfe8cb433f425789cc51ff3b5043815730a6ad39","Owner":"docker","IsDummy":false,"VolumePath":"\\\\?\\Volume{57c5c9fc-457a-11e6-b901-9f8c073a0421}",
"IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\ad21aac97cd17479a596c302dfe8cb433f425789cc51ff3b5043815730a6ad39","Layers":[{"ID":"d8d90394-03a9-5513-976b-9923314296d4",
"Path":"C:\\ProgramData\\Microsoft\\Windows\\Images\\CN=Microsoft_WindowsServerCore_10.0.14300.1000"}],"HostName":"ad21aac97cd1",
"MappedDirectories":[{"HostPath":"C:\\ProgramData\\docker\\volumes\\127336be0d3b886a0b956da32613eb340f1a932e3f822b6a7caad59b3e83e379\\_data","ContainerPath":"d:\\new-data-volume","ReadOnly":false}],
"SandboxPath":"","HvPartition":false,"EndpointList":["354a7efe-552d-4e93-859e-eedfcef48497"],"HvRuntime":null,"Servicing":false}.

Of course

docker run -it -v c:\new-data-volume windowsservercore cmd

works.

@rohitjaini
Copy link

You should be able to get it work with below command: docker run -it --volume=d:\new-data-volume:c:\datavolume windowsservercore cmd

@mwieczorek
Copy link
Contributor Author

@rohitjaini Well, that's not what I want.
In your example D:\ is in source (host) and C:\ is in destination (container).
My question is about opposite direction

@jstarks
Copy link
Contributor

jstarks commented Jul 15, 2016

We support mapping a whole second drive letter, but for now, not portions of it. So you can say

docker run -it -v d: windowsservercore cmd

and get a volume as drive D: in the container. But you can't write d:\data-volume or event d:\; it must be d:.

@mwieczorek
Copy link
Contributor Author

@jstarks Thank you for the explanation

@neilpeterson
Copy link
Contributor

neilpeterson commented Jul 18, 2016

Thanks @jstarks - I've added this to documentation.

scooley pushed a commit that referenced this issue Oct 17, 2017
* Adding version compatibility page
* Update version-compatibility.md
Adding information to docker swarm.
* Update version-compatibility.md
* Starting Docker Swarm workaround
* Adding example swarm failure
* reorder docker swarm to put easiest fix first
* update todo
* Update version-compatibility.md
Adding details about swarm modifications to run explicitly in hyper-v isolation.
* Update version-compatibility.md
Adding some clarity for inspecting a container.
* Update version-compatibility.md
* Added placeholder & link for service constraints
* Adding service constraint example
* Update version-compatibility.md
* Starting doc for Linux containers
* Adding additional link to Docker EE preview
* Fix markdown around video
* Update INotify
* Starting k8s info
* Starting kubernetes node labels
* Updating k8s samples
* Finishing k8s label example
* Adding Hyper-V isolation for Kubernetes
* Fixing headings and removing a bad section
* Adding link to winspector
@dtretyakov
Copy link

@jstarks, @neilpeterson, @scooley, could you please clarify how non C drive volume mapping should work?
For example:

D:\> mkdir folder
D:\> docker run --rm -it -v D: microsoft/nanoserver:1709 cmd /c "dir D:"
 Directory of D:\

05/11/2018  11:29 AM    <DIR>          .
05/11/2018  11:29 AM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  94,127,910,912 bytes free

When starting powershell in the container it fails with a following error:

Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.
dir : Cannot find drive. A drive with the name 'D' does not exist.
At line:1 char:1
+ dir D:
+ ~~~~~~
+ CategoryInfo          : ObjectNotFound: (D:String) [Get-ChildItem], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

So it looks like it just creates an empty drive D: inside container and does not provide any content from the host filesystem or this drive has problems with permissions to access it.

D:\> docker info
Containers: 4
 Running: 1
 Paused: 0
 Stopped: 3
Images: 11
Server Version: 18.04.0-ce
Storage Driver: windowsfilter (windows) lcow (linux)
 Windows:
 LCOW:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 16299 (16299.431.amd64fre.rs3_release_svc_escrow.180502-1908)
Operating System: Windows 10 Pro Version 1709 (OS Build 16299.431)
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 63.97GiB
Name: munit-199
ID: LLWJ:P3CA:ITHO:GODJ:OCUX:R4LO:6ASW:FPGJ:RWX3:UT6D:L7ZR:7LG4
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 30
 System Time: 2018-05-11T11:29:51.2341926+02:00
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

gitlab-runner-bot pushed a commit to gitlabhq/gitlab-runner that referenced this issue Jul 4, 2019
When a user specifies `builds_dir=F:\\builds` inside of `config.toml`
file, and run the `docker-windows` executor the user would get an error
like below:

```
Error response from daemon: The parameter is incorrect.
```

As explained in
MicrosoftDocs/Virtualization-Documentation#334
Docker volumes apart from `C:` are not supported.
@chaos95
Copy link

chaos95 commented Sep 29, 2020

Hi folks, developer from the future here, digging deep into the past for an issue I'm currently having while trying to run a WS2019 container.

It's taken me a few hours of detective work to find this issue and the corresponding doc fix that was made in response to it - unfortunately that fix seems to have been lost in translation some time in the last 4 years, because the current persistent volumes doc at https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/persistent-storage doesn't mention this limitation.

My experience in practice, however, shows that it still exists. @jstarks - would you happen to know if there has been any progress made on this? I'm guessing it never quite had enough priority to be addressed, which is fine, but I'd been interested to find out if it's ever been looked at since.

At any rate, I will aim to submit a PR here that adds in a mention of the limitation sometime soon, work permitting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants