search

Home  >  Q&A  >  body text

虚拟机 - 在 windows下 安装 Docker Toolbox 配置 docker 开发环境

安装 docker

windows 官方文档安装

Dockerwindow下 是安装在 VirtualBox. 虚拟机里的 ,而我们的开发环境代码 则是在 window

在运行 虚拟机里的 docker 容器是 可以挂在 虚拟机的 代码 在 docker 容器里跑,

但问题来了, 代码在 window 下, docker 容器 怎么通过 虚拟机 在 获得 window 下的代码呢

也就是说 ,在 VirtualBox. 虚拟机里的 Docker 容器 ,怎么跑 window 下的 代码呢;

ringa_leeringa_lee2775 days ago922

reply all(3)I'll reply

  • 大家讲道理

    大家讲道理2017-04-24 09:11:24

    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.

    reply
    0
  • PHPz

    PHPz2017-04-24 09:11:24

    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.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-24 09:11:24

    If it is win7.
    Know your virtual machine name via command line

    docker-machine ls
    NAME   ACTIVE    DRIVER   STATUS   URL    SWARM   DOCKER  ERRORS
    default -          vbox     staring ....   ....     ....   ....

    Open vbox->Select the virtual machine named default->Settings->Folder Sharing->Add shared folder->Select path (fixed allocation, automatic mounting)

    docker-machine ssh default
    $ [sudo] mkdir /文件夹
    $ [sudo] mount -t /宿主机的文件名 /文件夹
    $ exit

    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

    reply
    0
  • Cancelreply