Boot2Docker on Mac - Accessing Local Files

后端 未结 4 970
失恋的感觉
失恋的感觉 2020-12-09 18:56

I\'ve just set up boot2docker on my Mac. How do I go about mounting a local directory on my Mac so that it\'s accessible all the way through to a running Docker container? T

4条回答
  •  有刺的猬
    2020-12-09 20:01

    boot2docker with share other than /Users

    see https://github.com/boot2docker/boot2docker/issues/678.

    Share your folder with the VM:

    VBoxManage sharedfolder add boot2docker-vm --name /tmp/Work --hostpath /CODE --automount

    Based on info found un bootscript.sh, you know that the VM will run a bootlocal.sh script that is in the /var/lib/boot2docker folder, where data persists.

    Add a file /var/lib/boot2docker/bootlocal.sh

    #!/bin/sh
    # bash is not available!
    mkdir -p /CODE
    mount -t vboxsf /tmp/Work /CODE
    

    Then chmod +x /var/lib/boot2docker/bootlocal.sh and reboot your boot2docker-vm vm.

提交回复
热议问题