5

New to Docker, and running Docker Toolbox on Win 10 x64.

I'm trying to share (mount) a local Windows path with a container (Portainer in this case) so that the container will save all of it's config settings, locally on my PC, so that I can always upgrade the container while still having it's configuration persistant.

I have read/watched many tutorials, reference, docs, vids, etc., I'm trying to do what they seem to explain to do, but when I create the container with the local path mounted and then go into the container, set some config settings, and then look at the windows path I had mounted, there's nothing being saved there.

Not sure what the problem is?

Here's an example docker cmd I'm running:

docker run -it -v /c/Servers/DockerConfigs/Portainer:/data :P portainer/portainer

To my understanding, whatever gets stored in the /data folder in the container should also get saved to the Windows folder on the host C:\Servers\DockerConfigs\Portainer, but nothing is getting saved to that windows folder ...

I've also tried copying some files on the host to that windows folder, and then within the container viewing the /data folder to see if they show up using ls -a but again, nothing shows up in there ...

Anyone know what I'm missing?

jww
  • 97,681
  • 90
  • 411
  • 885
J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94

4 Answers4

3

Make sure that the C drive is enabled for sharing: Right click on the whale icon -> Settings -> Shared Drives. Also consider using the newer Docker Desktop for Windows.

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
Chris
  • 31
  • 3
  • Thanks, unfortunately when I enable Hyper-V on any of my Win 10 machines, I end up in a boot loop, so at least for now I'm stuck using Docker Toolbox. – J. Scott Elblein Feb 10 '19 at 18:47
2

Finally found out the answer thanks to this thread: How to mount a host directory in a Docker container

Turns out the easiest way (on Windows) is to make sure to mount your folders from your Users directory, and use the --mount command when starting the container.

i.e.

docker run -P -it --name organizr --mount src="/c/Users/My PC/AppData/Roaming/DockerConfigs/Organizr",dst=/config,type=bind organizrtools/organizr-v2:latest
J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
0

Me too had the same issue. So, I did the below steps.

  • First, pull the windowsserver container(You can pull any container based on your requirement).

  • Go to docker desktop, select images.

  • You can see the image you pulled. Select run, then change the settings. That is, set a container name, a path in your machine you want to mount, container path(for that, I simply gave C:\data)

  • Then save the settings

  • Go to containers/apps in docker desktop.

  • You can see the new container name you have created.

*Open cli of that container >- (this symbol)

  • then a cli with path as C:\ will be opened.

*Type dir. You can see the folder data created there.

Now, add some files in the mounted folder of your local machine and see whether it is reflected in the data folder of container.

Anna Sam
  • 5
  • 2
-2

Stop doing anything and do this:

  1. Uninstall Docker Desktop (stable)
  2. Restart Windows machine
  3. Install Docker Desktop (Edge)
  4. issue resolved
J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
skipper_dev
  • 173
  • 1
  • 4