How to deploy Dockerfile and application files to boot2docker

前端 未结 6 606
孤城傲影
孤城傲影 2021-02-01 14:16

I\'m just starting to learn Docker, and I\'m trying to get a simple setup with boot2docker on Windows. I could not find in any tutorial or samples online how to make my project

相关标签:
6条回答
  • 2021-02-01 14:26

    IMHO the best way would be to use scp. As you can ssh, you can use winscp to send the Dockerfile to the VM.

    0 讨论(0)
  • 2021-02-01 14:26

    ssh the file into your VM

    dockerfile=$(cat LocalDockerfile)
    boot2docker ssh "echo '$dockerfile' > Dockerfile"
    

    wrote it up here http://micahasmith.github.io/2014/11/07/copying-files-into-boot2docker/

    0 讨论(0)
  • 2021-02-01 14:27

    Not sure if it helps under windows. But for Mac see:

    boot2docker together with VirtualBox Guest Additions
    How to mount /Users into boot2docker

    https://medium.com/boot2docker-lightweight-linux-for-docker/boot2docker-together-with-virtualbox-guest-additions-da1e3ab2465c

    tl;dr Build your own custom boot2docker.iso with VirtualBox Guest Additions (see link) or download http://static.dockerfiles.io/boot2docker-v1.0.1-virtualbox-guest-additions-v4.3.12.iso and save it to ~/.boot2docker/boot2docker.iso.

    0 讨论(0)
  • 2021-02-01 14:29

    On Boot2Docker change your directory "cd /c" you will be able to see Users folders on Windows. Put the content you wanna share in your prefered Users Folders.

    0 讨论(0)
  • 2021-02-01 14:34

    Following your current progress, and presuming your samba container is running, you can find the path to the /data folder on your Boot2docker VM by running:

    $ docker inspect <samba_container_id>
    

    This will list the containers configuration details. Near the very bottom you should see:

    "Volumes": {

        "/data": "/mnt/sda1/var/lib/docker/vfs/dir/<long_id_here>
    

    That's your boot2docker vm /data path. Simply cd into that folder

    $ cd /mnt/sda1/var/lib/docker/vfs/dir/<long_id_here>
    

    From Windows Explorer, Navigate to:

    \\192.168.59.103\data
    

    Now you can paste/copy/create some files into that data folder and you should see them populate on your Boot2docker VM at path: /mnt/sda1/var/lib/docker/vfs/dir/<long_folder_id_here>

    0 讨论(0)
  • 2021-02-01 14:44

    I use vagrant with this box : https://vagrantcloud.com/yungsang/boot2docker

    and I changed Vagrant file to use (auto-)rsync on Windows :

      rsync_args = ["--verbose", "--archive", "--delete", "-z"]
      rsync_auto = true
      rsync_exclude = [".vagrant/"]
      config.vm.synced_folder ".", "/vagrant", rsync__args: rsync_args, rsync__exclude: rsync_exclude, rsync__auto: rsync_auto, type: "rsync"
    
    0 讨论(0)
提交回复
热议问题