title: Connecting Vagrant VMs and Docker containers to the same bridge network
body: <p>I have followed the instructions at this question's answer to connect both Vagrant VMs and Docker containers to the same bridge network: <a href="https://stackoverflow.com/questions/48507357/access-vagrant-vms-from-inside-docker-container">Access vagrant VMs from inside docker container</a>. The status of the networking is the following:</p>
  
  <ul>
  <li>Both containers and VMs can ping each other correctly.</li>
  <li>VMs and containers can't connect to ports exposed by each other using curl.</li>
  <li>VMs have internet access, while containers don't.</li>
  <li>I can't access to the container from the host through exposed port (neither through localhost or containers IP).</li>
  <li>I can access correctly to ports exposed by VMs from the host and over the network.</li>
  </ul>
  
  <p>I have created the network this way:</p>
  
  <pre><code>docker network create -d bridge --gateway=192.168.51.1 --subnet=192.168.51.0/24 my-bridge
  </code></pre>
  
  <p>The Docker container:</p>
  
  <pre><code>docker run -ti -p 8912:8080 -v ${PWD}:/workdir --network my-bridge --name mycontainer myimage /bin/bash
  </code></pre>
  
  <p>And the Vagrantfile:</p>
  
  <pre><code>config.vm.define "management" do |management|
      management.vm.box = "centos/7"
      management.vm.network "public_network", ip: "192.168.51.50", bridge: "br-4ab95f14d7eb"
      management.vm.hostname = "myhostname"
  
      management.vm.network "forwarded_port", guest: 32769, host: 32769
      management.vm.network "forwarded_port", guest: 32768, host: 32768
      management.vm.network "forwarded_port", guest: 8080, host: 8081
      management.vm.network "forwarded_port", guest: 8443, host: 8082
      management.vm.network "forwarded_port", guest: 6080, host: 6080
      management.vm.network "forwarded_port", guest: 61880, host: 61880
      management.vm.network "forwarded_port", guest: 6182, host: 6182
  
      management.vm.provider "virtualbox" do |v|
        v.memory = 8192
        v.cpus = 4
      end
  </code></pre>
  
  <p>end</p>
  
  <p>Being br-4ab95f14d7eb the bridge network:</p>
  
  <pre><code># docker network ls | grep my-bridge
  # 4ab95f14d7eb        my-bridge          bridge              local
  # brctl show | grep 4ab95f14d7eb
  # br-4ab95f14d7eb       8000.02423ffbd644   no  
  </code></pre>