0
Ubuntu 5.3.0-51-generic
Docker version 19.03.6 (Docker CE)

I have two network adapters with network interfaces Device0 and Device1 that i want to connect to Container0, and Container1.

Each container needs to have its own ip-address, followed by the other, say 172.16.0.10 to 172.16.0.11

I've read that it could be good to use the macvlan utility.

Using the following code, where i [0,1] I try to create 2 different macvlans, connecting said devices:

docker network create -d macvlan \
    --subnet=172.16.0.1$i/24 \
    -o parent=Device$i \
    macvlan_$counter

The code creates a first network but fails on the second, due to overlaps in address space

fd351775c70e1a3718e78bbed07e8f7a577a203f8526d2f80dad1b3e8f5f6482 
Error response from daemon: Pool overlaps with other one on this address space

Any idea how to work around this problem?

  • "I've read that it could be good to use the macvlan utility." There are a very small number of use cases where macvlan networks actually make sense. What exactly are you trying to do? Why are you trying to create multiple networks? It sounds like you want all your containers on the same network. – larsks May 14 '20 at 12:42
  • I want to create a direct link between the NIC of the network adapter into the container. Like it would be connected to "host" network. – Tor on tour May 14 '20 at 12:55
  • macvlan is intended to provide an entire subnet for one or more containers where each container has its own MAC address and IP address. So you can try to restrict the subnet to just the specific IP address you want. But I think you would be better off assigning your IPs to your ethernet devices and bind your containers to those IPs, e.g. `docker run -it -p 172.16.0.10:8080:80`. This is covered in the container networking docs: https://docs.docker.com/config/containers/container-networking/ – Jordan Deyton Dec 21 '20 at 06:55

0 Answers0