-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Host name lookup failure or missing networks when using multiple networks #10777
Copy link
Copy link
Closed
Labels
Description
Originally posted by @ToshY in #10668 (comment):
@milas While this seems to fix the not connected to network issue, it gave me a forward host lookup failed: Host name lookup failure in return when running waisbrot/wait with docker compose run.
Example
version: '3.9'
services:
mysql:
image: ${MYSQL_IMAGE_VERSION}
ports:
- "3308:3306"
environment:
MYSQL_USER: ${DATABASE_USER}
MYSQL_DATABASE: ${DATABASE_NAME}
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
MYSQL_PASSWORD: ${DATABASE_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
networks:
- webapp
wait:
image: waisbrot/wait
environment:
TARGETS: mysql:3306
TIMEOUT: 300
networks:
- webapp
volumes:
mysql_data:
driver: local
networks:
webapp:
driver: bridge$ docker compose up -d
[+] Running 4/4
✔ Container webapp-wait-1 Started 3.0s
✔ Container webapp-mysql-1 Started 2.9s
$ docker compose run --rm wait
Waiting for mysql:3306 .mysql: forward host lookup failed: Host name lookup failure
.mysql: forward host lookup failed: Host name lookup failure
.mysql: forward host lookup failed: Host name lookup failure
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
webapp-mysql-1 mysql:8.0 "docker-entrypoint.s…" mysql 8 minutes ago Up 5 minutes 33060/tcp, 0.0.0.0:3308->3306/tcp, :::3308->3306/tcpReactions are currently unavailable