Error=”HTTP request failed: Get “http://host.docker.internal:8080/\”: dial tcp: lookup host.docker.internal on 127.0.0.11:53: no such host” 해결

문제

Docker 기반의 WordPress 서비스를 Production 에 올릴 때 아래와 같은 에러가 나오고 Docker -> Docker 연결에 문제가 생겼다.

traefik error=”HTTP request failed: Get \”http://host.docker.internal:8080/\”: dial tcp: lookup host.docker.internal on 127.0.0.11:53: no such host”

분명 MacOS 와 Windows 에서는 잘 되었지만 Ubuntu 같은 Linux 환경에 올라가니 문제가 발생했다.

해결방법

Docker Compose 기준으로 아래와 같은 옵션을 추가해 주면 된다.

extra_hosts:
  - "host.docker.internal:host-gateway"

이렇게 host 를 추가해주면 Docker 가 알아서 host.docker.internal 이라는 주소를 hosts 부분에 넣어 있는 정상적으로 리디랙션 시켜줍니다.

이렇게 작성하면 host.docker.internal:5002 같은 주소가 정상적으로 Linux 시스템에서도 작동하는 것을 확인할 수 있다!

https://docs.docker.com/compose/compose-file/compose-file-v3/#extra_hosts

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments