Docker version 26.1.4, build 5650f9b
Docker Compose version v2.34.0
Running wget http://google.com
from my host succeeds.
Running the same command from a container started using docker run -it --rm alpine
succeeds.
Running the same command from a container started using docker compose run --rm --remove-orphans test
fails (it resolves DNS but the download times out).
The docker-compose.yml is simply:
services:
test:
image: alpine
networks:
- my-test
networks:
my-test:
I’ve tried explicitly adding driver: bridge
to the network. This does not work.
I’ve tried changing the service from networks: my-test
to network_mode: bridge
. This does work, but isn’t desirable since I want it to have a custom network for isolation and service aliases.
How do I diagnose this further, or ideally fix it?