Skip to content

MacVLAN. A network locks the gateway ip preventing to assign it #1447

@brugnara

Description

@brugnara

I am excited about the features you have made in 1.12, so please let me say: thank you guys 😗

Now the lettuce... ;)

First of all, this is the network I have created

docker network rm vlan150
docker network create -d macvlan \
    --subnet=10.150.0.0/24 \
    --gateway=10.150.0.254 \
    -o macvlan_mode=bridge \
    -o parent=eth0.150 vlan150

Let me say here, the 10.150.0.254 does not exists in the network.

Now let's start a container on that network:

docker run --net=vlan150 --ip 10.150.0.254\
  -it --name server --rm alpine /bin/sh
docker: Error response from daemon: Address already in use.

This is not true. That address is not in use.. So let's circumnavigate that, this way:

docker run --net=vlan150 --cap-add NET_ADMIN \
  -it --name server --rm alpine /bin/sh
/ # ifconfig eth0 10.150.0.254 netmask 255.255.255.0

Now that container has the right gateway and every container connected to the vlan150 simply uses that as default gateway and everything work.

Am I missing something basic here? I saw pipeworks but I think it is too much for this simple use case.

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions