title: Vagrant set docker container network to host mode
body: <p>I would like to launch a vagrant VM with a Docker provisioner, and set the network type of a docker container to <code>host</code>.</p>
  <p>Is it something that is feasible?</p>
  <p>My actual config for this container is below:</p>
  <pre><code>config.ssh.insert_key = false
    config.vm.define &quot;dev&quot;, primary: true do |app|
      app.vm.provider &quot;docker&quot; do |d|
        d.image = &quot;allansimon/allan-docker-dev-python&quot;
        d.name = &quot;#{PROJECT}_dev&quot;
        d.has_ssh = true
        d.env = DOCKER_ENV
        d.link &quot;#{PROJECT}_db:db&quot;
        d.ports = [&quot;0.0.0.0:7011:8000&quot;]
      end
      app.ssh.username = &quot;vagrant&quot;
  
      # so that we can git clone from within the docker
      app.vm.provision &quot;file&quot;, source: &quot;~/.ssh/id_rsa&quot;, destination: &quot;.ssh/id_rsa&quot;
      app.vm.provision &quot;install_everything&quot;, type: &quot;shell&quot;, privileged: false  do |s|
        # needed to pass DB credentials for running the alembic migration
        s.env = DOCKER_ENV
        s.inline = &quot;
          set -e
          cd /vagrant
  
          python3.8 -m venv /tmp/venv
          source /tmp/venv/bin/activate
          pip install --upgrade pip
          pip install wheel
          pip install -r requirements/dev.txt
  
          ./manage.py migrate
  
          echo 'source /tmp/venv/bin/activate' &gt;&gt; /home/vagrant/.zshrc
          echo 'cd /vagrant' &gt;&gt; /home/vagrant/.zshrc
        &quot;
      end
  </code></pre>