Docker compose with static IP for external network

My guess: It doesn’t work because you refer to your external network with the external name instead of the name you used under networks. Try this:

version: '3'

services:
  reverse-proxy:
    image: traefik:v2.5
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      default:
        ipv4_address: 192.168.1.2
networks:
  default:
    external: true
    name: my-dhcp-eth0-6d6da6

or this

version: '3'

services:
  reverse-proxy:
    image: traefik:v2.5
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      my-dhcp-eth0-6d6da6:
        ipv4_address: 192.168.1.2
networks:
  my-dhcp-eth0-6d6da6:
    external: true
    name: my-dhcp-eth0-6d6da6
1 Like