Create container with routable ip address

Dear all,

I have been trying to do the following setup the last few days. Unfortunately unsuccessfully.

Docker host where host’s:

  • eth0 is the management ip 192.168.1.10 with gateway 192.168.1.1.
  • eth1 resides in network 10.10.10.0/24 which I want to use for assigning container addresses.

Besides the default docker0 bridge, another bridge is created with macvlan capabilities as follows:

 docker network create -d macvlan \
  --subnet=10.10.10.0/24 \
  --gateway=10.10.10.1 \
  -o parent=eth1 \
  container_macvlan

Then container is created in container_macvlan network.

docker run --rm -itd \
  --network container_macvlan \
  --name external_ip_tests \
  centos:7 \
 /bin/bash

Container gets created successfully and IP can be seen from inside.

docker exec external_ip_tests hostname -I

10.10.10.2

The problem is that I cannot ping anything in that network from within the container, not even the gateway.
Though I can ping other containers that reside on that bridge (default docker behaviour).
The container cannot be accessed from the outside as well. :confused:

Why there is no routing ? Docker networking documentation explains that macvlan networks create container interface which looks like a VM interface (has IP and MAC) from the network side.

Is there something wrong in my approach? May be I miss something important.

FYI - docker host is Centos 7 - 3.10.0-693.11.6.el7.x86_64 VM hosted on Xenserver 7.1.

Thank you for your time!