windows
官方文档安装
Docker
在window
下 是安装在 VirtualBox
. 虚拟机里的 ,而我们的开发环境代码 则是在 window
下
在运行 虚拟机里的 docker
容器是 可以挂在 虚拟机的 代码 在 docker
容器里跑,
但问题来了, 代码在 window
下, docker
容器 怎么通过 虚拟机 在 获得 window
下的代码呢
也就是说 ,在 VirtualBox
. 虚拟机里的 Docker 容器 ,怎么跑 window
下的 代码呢;
I haven’t tried it under Windows, but I know that under Linux it is achieved by sharing a certain directory (mounting the volume). Then, as long as I put the file in the directory of the host (that is, the real machine), the application in the container can access the files in this directory.
It is also implemented by mounting volumes. But it should be noted that there is an additional abstraction layer on Windows and Mac, that is, a virtual Linux host. According to my practice on windows, it needs to be mounted twice, once to the virtual machine and once to mount the volumes to the container.
If it is win7.
Know your virtual machine name via command line
Open vbox->Select the virtual machine named default->Settings->Folder Sharing->Add shared folder->Select path (fixed allocation, automatic mounting)
When starting the container, specify -v to specify that all files that appear in the specified folder on the host will appear in the container