How to copy files from Windows host to Docker cont

2019-04-30 01:20发布

Looking for a quick solution to copy local files to a Docker container on Windows. I wasn't able to find this in other Stack Overflow solutions.

You might call this mounting a local drive on Windows within a docker container.

2条回答
女痞
2楼-- · 2019-04-30 02:01

Open the Docker settings from the icon on the taskbar:

Docker popup

Go to 'Shared Drives' and enable your local drive to be made accessible to your containers:

Docker shared drive settings

Now you can add folders from your shared drive as a volume in a container. Using the nginx example from the Docker getting started guide:

docker run -it -v c:/Users:/data nginx /bin/bash

That will give you shell access, where you can find your local files (c:/Users) in the /data directory of your nginx container.

查看更多
Root(大扎)
3楼-- · 2019-04-30 02:23

If windows OS is not win 10 pro, then the docker is installed usnig Docker Toolbox. In this case one may not find settings dialogue option in the taskbar. See here https://stackoverflow.com/questions/42326563/mounting-windows-drives-to-access-from-docker for a way to mount windows folders to access from containers.

查看更多
登录 后发表回答