Open festus1973 opened 7 years ago
Just a follow-up on this in case anyone else encounters the same thing. Mounting a host directory actually calls for use of the HostConfig
class, not Config
as indicated in some of the other forum posts here. Further, it's the 'Bind' property, not 'Volumes' that should be used to construct the mount. The follow revised script works and the directory is now visible from the container:
$config = [Docker.DotNet.Models.HostConfig]::new();
$config.Binds= new-object 'system.collections.generic.list[string]';
$config.Binds.Add("c:\temp:c:\scripts");
Run-ContainerImage "core_usr_img" -name "festus" -Detach -input -HostConfiguration $config
The following command executes successfully and I'm able to view my host directory "C:\temp" as "C:\scripts" on the container:
docker run -it -d --name festus -v c:\temp:c:\scripts core_usr_img
...but when performing the same action using the PowerShell module as follows...
...the container starts up, 'scripts' appears as a folder in c:\, but it's empty. The container can't see the contents of the folder. Again, this works just fine using the raw 'docker' call. Only when using the PowerShell module does this bug occur. Any ideas?