Strange behavior with Docker network bridge when using custom DNS on Ubuntu 22.04
I'm upgrading from an older version and I'm sure I'm missing something obvious here, but Hey everyone, I'm running into an issue that's driving me crazy... I'm having issues with a custom Docker network bridge on my Ubuntu 22.04 machine. I created a bridge network named `my_custom_net` and specified a custom DNS server in the `docker-compose.yml` file, but my containers are unable to resolve hostnames. Hereβs how I set it up: ```yaml version: '3.8' services: app: image: my_app_image networks: my_network: ipv4_address: 172.18.0.2 db: image: my_db_image networks: my_network: ipv4_address: 172.18.0.3 networks: my_network: driver: bridge driver_opts: com.docker.network.bridge.name: my_custom_net ipam: config: - subnet: 172.18.0.0/16 - gateway: 172.18.0.1 dns: - 8.8.8.8 ``` Despite the DNS configuration, when I try to ping a service like `db` from `app`, it fails with the behavior `ping: db: Name or service not known`. I checked the bridge network using `docker network inspect my_custom_net`, and it shows the correct DNS settings. I tried running the containers in the default `bridge` network, and DNS resolution works as expected. I'm unsure of what might be causing the failure in the custom network. I also verified that the Docker daemon is running and updated to the latest version available for Ubuntu 22.04. Any insights into why the custom DNS isn't functioning as expected would be greatly appreciated! My development environment is Windows. What's the best practice here? I'm working on a web app that needs to handle this. Am I missing something obvious? For reference, this is a production CLI tool. I'd love to hear your thoughts on this.