• 6 Posts
  • 12 Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle







  • networks:
      app:
        ipam:
          config:
            - subnet: 172.20.0.0/24
              gateway: 172.20.0.1
    services:
      app:
        image: my-app-image
        networks:
          app:
            ipv4_address: 172.20.0.10
    

    In the above example I’ve declared a Docker Bridge network with the range 172.20.0.0/24 and a gateway at 172.20.0.1. I have a service named app with a static IP of 172.20.0.10.

    The same is also possible with IPv6, though there are extra steps involved to make IPv6 networking work in Docker and it’s not enabled by default so I won’t go into detail in this comment.

    Out of curiosity, what’s the use case for a static IP in the Docker Bridge network? Docker compose assigns hostnames equal to the service name. That is, if you had another container in the app network from my example above, it could just do a DNS lookup for app and it would resolve to 172.20.0.10.











  • cool_pebbletoMetaHourly 502 errors
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    Would it be worth chucking in an hourly restart cron job/systemd timer for the time being? Not an ideal solution for sure, but maybe that’s better than having to jump into the server every few hours (and users experiencing a seemingly stale feed).