流浪汉+;docker无法使用专用网络访问docker实例

流浪汉+;docker无法使用专用网络访问docker实例,docker,docker-compose,vagrant,docker-networking,vagrant-windows,Docker,Docker Compose,Vagrant,Docker Networking,Vagrant Windows,我使用ubuntu-18.04映像通过Vagrant创建了VirtualBox虚拟机,并安装了docker ce和docker compose。虚拟机具有NAT和专用网络。下面是流浪汉档案 Vagrant.configure("2") do |config| config.vm.box = "ubuntu/bionic64" config.vm.define "kp-ms" config.vm.hostname = "kp-ms" config.vm.network "priv

我使用ubuntu-18.04映像通过Vagrant创建了VirtualBox虚拟机,并安装了
docker ce
docker compose
。虚拟机具有NAT和专用网络。下面是流浪汉档案

Vagrant.configure("2") do |config|

  config.vm.box = "ubuntu/bionic64"
  config.vm.define "kp-ms"
  config.vm.hostname = "kp-ms"
  config.vm.network "private_network", ip: "192.168.64.10", netmask: "255.255.254.0"
  config.vm.synced_folder "./data", "/data"

  config.vm.provider "virtualbox" do |vb|
    vb.gui = false
    vb.memory = "4096"
    vb.name = "kp-ms"
    vb.check_guest_additions = false
    vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
  end

  config.vm.provision "shell", inline: <<-SHELL

    apt-get update
    apt-get upgrade -y
    apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
    apt-key fingerprint 0EBFCD88
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    apt-get update
    apt-get install -y docker-ce docker-ce-cli containerd.io
    curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose

    sudo docker network create -d macvlan \
          --subnet=192.168.64.0/23 \
          --ip-range=192.168.64.192/28 \
          -o macvlan_mode=bridge \
          -o parent=enp0s8.10 mac10

    sudo ip link add mac10 link enp0s8.10 type macvlan mode bridge
    sudo ip addr add 192.168.64.193/28 dev mac10
    sudo ifconfig mac10 up

    sudo docker-compose -f /data/docker-compose.yml up -d
  SHELL
end
如上面的docker compose文件所示,我为docker实例提供了一个静态IP,该实例位于专用网络子网中,并使用MAVLAN创建了docker网络,并桥接到专用网络。 通过上面的网络,我可以从来宾VM ping到docker实例,但是我无法从主机ping到docker实例(在我的例子中是Windows 10)

从数据包分析中,我发现docker实例的ARP(没有ARP重播)并没有得到解决。如何使用IP地址从主机访问docker实例?我不寻找端口转发,因为这个docker compose是示例一,docker compose有4-5个附加服务。我尝试过使用
ovs docker
问题是,无法为docker实例之间的通信设置额外的网络

version: '3.7'
services:
  nginx:
    image: nginx
    networks:
      kp-net:
        ipv4_address: 192.168.64.200
networks:
  kp-net:
    external: true
    name: mac10