Docker Community Forums

Share and learn in the Docker community.

Not networking in macvlan network

Hi friends,
I have been doing docker tests for a few days on my debian machine and a raspberry, and there is something I do not understand.

I want my container to have an ip and be visible to the other devices on my LAN.
For this I first make a macvlan network

docker network create -d macvlan -o parent=eth0 --subnet 192.168.1.0/24 --gateway 192.168.1.1 --ip-range 192.168.1.192/28 LAN_HOME

Then in my docker-compose I put the following:

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    networks:
      default:
         ipv4_address: 192.168.1.193
    environment:
      TZ: 'America/Chicago'
      WEBPASSWORD: '1234123'
#Volumes store your data between container upgrades
    volumes:
       - './etc-pihole/:/etc/pihole/'
       - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    dns:
      - 127.0.0.1
      - 1.1.1.1
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
networks:
  # Define the default network
  default:
    external:
      name: LAN_HOME

and he container doesn’t have networw. If I open a bash on the container, ip a command shows

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
10: eth0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:c0:a8:01:c1 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.193/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever

but I cannot ping anybody.
What am I doing wrong?

Thanks a lot