Vagrant synced_folder not working with docker provider build_dir (Windows)

I don’t succeed providing a dockerfile via Vagrant on Windows. If I use an image (e.g. d.image = "phusion/baseimage" instead of build_dir everything is fine – but when building from a dockerfile (as shown in the vagrantfile below) – I get the following error (of course I have a Dockerfile in infrastructure/ssh-docker!):

PS C:\privat\cloud-backup\cloud-backup-for-podio> vagrant up
Bringing machine 'app' up with 'docker' provider...
==> app: Docker host is required. One will be created if necessary...
    app: Docker host VM is already ready.
==> app: Syncing folders to the host VM...
    app: Preparing SMB shared folders...
    app: Mounting SMB shared folders...
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/guests/linux/cap/choose_addressable_ip_addr.rb:7:in `block
 in choose_addressable_ip_addr': undefined method `each' for nil:NilClass (NoMethodError)
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/guests/linux/cap/choose_addressable_ip_addr.rb:6:in `tap'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/guests/linux/cap/choose_addressable_ip_addr.rb:6:in `choose_addressable_ip_addr'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/capability_host.rb:111:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/capability_host.rb:111:in `capability'
        ...

Vagrantfile:

  • Dynamically Pull Docker Image using chef recipe
  • Emulate Bluetooth LE Adapter for Acceptance Testing
  • Zero Downtime app deployment with CoreOS
  • How to debug docker container with PhpStorm
  • Why do you need a base image with Docker?
  • Is there an alternative/workaround for `boot2docker save`?
  • Vagrant.configure("2") do |config
    
      config.ssh.username = 'vagrant'
      config.ssh.password = 'tcuser'
      config.ssh.port = 22
    
      config.vm.define "app" do |app|
        app.vm.synced_folder ".", "/vagrant", type: "smb", smb_host: "MY_IP", smb_username: "WINUSER@DOMAIN", smb_password: "WINPASSWORD"
        app.vm.provider "docker" do |d|
          #d.image = "phusion/baseimage"
          d.build_dir = "infrastructure/ssh-docker"
          d.name = "app"
          d.remains_running = true
        end
      end
    
    end
    

    Dockerfile:

    FROM phusion/baseimage
    
    ENV HOME /root
    
    # enable ssh
    RUN rm -f /etc/service/sshd/down
    
    # Regenerate SSH host keys. baseimage-docker does not contain any, so you
    # have to do that yourself. You may also comment out this instruction; the
    # init system will auto-generate one during boot.
    RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
    
    # Use baseimage-docker's init system.
    CMD ["/sbin/my_init"]
    
    RUN apt-get update
    
    RUN apt-get install -y openssh-server wget lsb-release sudo
    
    EXPOSE 22
    
    RUN mkdir -p /var/run/sshd
    RUN chmod 0755 /var/run/sshd
    
    # Create and configure vagrant user
    RUN useradd --create-home -s /bin/bash vagrant
    WORKDIR /home/vagrant
    
    # Configure SSH access
    RUN mkdir -p /home/vagrant/.ssh
    RUN echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /home/vagrant/.ssh/authorized_keys
    RUN chown -R vagrant: /home/vagrant/.ssh
    RUN echo -n 'vagrant:vagrant' | chpasswd
    
    # Enable passwordless sudo for the "vagrant" user
    RUN mkdir -p /etc/sudoers.d
    RUN install -b -m 0440 /dev/null /etc/sudoers.d/vagrant
    RUN echo 'vagrant ALL=NOPASSWD: ALL' >> /etc/sudoers.d/vagrant
    
    # Clean up APT when done.
    RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    

    Vagrant version: 1.7.4

    Anyone has some idea?

    (What I need to do is run a docker image from a dockerfile and have a shared/synced directory..)

  • Should I use a reverse proxy (eg NGINX) inside my Kuberenetes cluster?
  • Docker: communication between web container and php container
  • “Official” docker backup strategy - what about consistency?
  • Error copying file for Docker instantiation
  • Specify network security group for docker-machine to use
  • What's Docker easiest way to deploy Rails on production?
  • One Solution collect form web for “Vagrant synced_folder not working with docker provider build_dir (Windows)”

    You should provide your ip in for smb service

    config.vm.synced_folder “.”, “/home/vagrant/github-api”, type: ‘smb’, smb_host: “192.168.1.100”

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.