If you mount any folder on your local PC in the container launched by Docker You can freely put files in the closed NW in docker! I think, and summarize the results of my research
If you search for "Docker windows file sharing" on google, you'll be killed instantly. ・ When I looked at the content of the article, it was actually for Docker for Windows (* PCs that cannot run Hyper-V clients are not helpful because they use the Docker environment with Docker Toolbox). -Although there was a virtualbox setting (described later), the format of the command method on docker after that was ambiguous, so I did not understand well after all. I didn't like the environment I was in, so I had a hard time, so Leave it in the article so that you can start over even if the PC flies.
I don't know from just the outline, but the point is that there are 3 steps in total, so I'll leave it as a memo.
Start Docker Quickstart Terminal and execute the command. Use the following command to add 1. Mount the shared folder set in. With this, file sharing is connected by the connection of local PC → VirtualBox → Docker machine. The directory name created on the Docker Machine side is e, but anything is fine as long as it is not covered. Personally, I like it because it looks like a drive number and it is easy to understand that it is a shared folder.
DockerToolbox
$ docker-machine ssh default 'sudo mkdir -p /e'
$ docker-machine ssh default 'sudo mount -t vboxsf -o uid=0,gid=0 /C/Users/watya/work/docker /e'
Execute the command from Docker Toolbox. With the following command, 2. / E created in is mounted in / home of nginx container.
DockerToolbox
$ docker run -d -v /e:/home --name nginx nginx
If you log in for confirmation and check the contents of / home, you can confirm that it is mounted safely
The sites referred to this time are as follows. I mean, this is more polite and the explanation of the contents is deeper, so if you don't understand well, I would like to come back from time to time. https://humo-life.net/memo/doku.php?id=%E3%82%BD%E3%83%95%E3%83%88%E3%82%A6%E3%82%A7%E3%82%A2:docker:docker_toolbox%E3%81%A7%E3%83%9E%E3%82%A6%E3%83%B3%E3%83%88_%E5%85%B1%E6%9C%89%E3%83%95%E3%82%A9%E3%83%AB%E3%83%80_%E8%A8%AD%E5%AE%9A
Recommended Posts