Docker Community Forums

Share and learn in the Docker community.

I need to put my containers on the same network as my docker server

Greetings everyone

I’m trying to configure a subnet with the IPVLAN driver in L3 mode without success.

My settings are:

------------------------------------------------- --------------------------------------------

[Docker Host network settings]
#> cat /etc/netplan/01-netcfg.yaml

network:
    ethernets:
        enp1s0:
            addresses: ['192.168.10.1/24']
            gateway4: 192.168.10.254
            routes:
              - metric: 0
                to: 192.168.10.0/24
                via: 192.168.10.254
            nameservers:
                addresses: [192.168.10.1,192.168.10.5,8.8.8.8,8.8.4.4]
                search: [websis]
            dhcp4: false
            dhcp6: false

------------------------------------------------- --------------------------------------------

[Docker daemon configuration]
#> cat /etc/docker/daemon.json

{
  "beep": "192.168.9.1/24",
  "default-address-pools":[
    {"base":"192.168.10.0/16","size":24}
  ]
}

------------------------------------------------- --------------------------------------------

[Docker User Created IPVLAN Network configuration]
#> docker network create -d ipvlan --subnet=192.168.10.0/24 --ip-range=192.168.10.63/25 --gateway=192.168.10.11 -o ipvlan_mode=l3 -o parent=enp1s0.1 ntwkr_docker

------------------------------------------------- --------------------------------------------

[Docker Container Attached to IPVLAN Network configuration]
#> docker run --name myc -it --rm --net=ntwkr_docker --ip=192.168.10.73 alpine /bin/sh

And finally the failure of what was initially aimed at: putting the container on the docker host’s network:

------------------------------------------------- --------------------------------------------

#> ping -c 5 192.168.10.73
PING 192.168.10.73 (192.168.10.73) 56(84) bytes of data.
From 192.168.10.1 icmp_seq=1 Destination Host Unreachable
From 192.168.10.1 icmp_seq=2 Destination Host Unreachable
From 192.168.10.1 icmp_seq=3 Destination Host Unreachable
From 192.168.10.1 icmp_seq=5 Destination Host Unreachable
— 192.168.10.73 ping statistics —
5 packets transmitted, 0 received, +4 errors, 100% packet loss, time 4074ms
pipe 4

I’m orienting myself through the official docker documentation ( Use IPvlan networks | Docker Documentation ) and my goal is not to make containers in different vlans check/seem each other, but the container services to be accessed or viewed directly on the host’s network.

Where am I going wrong or not understanding something?

Is there anything else to be configured (route, firewall, dns) ?