본문 바로가기
Programming

Docker 이미지 실행 실패 해결

by Juhn with h 2025. 8. 22.

도커 설치 후 hello-world라는 이미지를 실행하는 기본 테스트를 시도해보았다.

DNS 서버에 접속을 하지 못해 URL을 찾지 못했다. 

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 156.16.156.2:53: no such host

Run 'docker run --help' for more information

 

헌데 ping 테스트를 해봐도 문제가 없고, 인터넷 브라우저로의 웹페이지 접속에도 문제가 없다. 

VMware Fusion 위에 설치한 Linux에 설치한 도커라서 생긴 문제로 생각된다. 가상머신을 한 겹 거치고 있으니까. 

리눅스에서 네임서버를 설정하는 파일인 /etc/resolv.conf를 열어보니 문제의 IP 주소가 쓰여있다. 

# Generated by NetworkManager
search localdomain
nameserver 156.16.156.2 

루트 권한으로 파일을 열고 DNS 서버를 구글 DNS로 변경해주었다.

$ sudo nano /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 8.8.8.8
nameserver 8.8.8.4

도커를 재시작하고 다시 이미지를 불러온다. 그러니 성공!

$ sudo systemctl restart docker
$ sudo docker run hello-world

# 로컬에 받아둔 이미지가 있는지 먼저 찾는다. 로컬엔 이미지가 없으므로...
Unable to find image 'hello-world:latest' locally

# 저장소로부터 이미지를 받는다.
latest: Pulling from library/hello-world
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (arm64v8)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

기존 nameserver가 어떻게 그 값으로 설정되었고, 왜 인터넷은 잘 되었는데 도커에서만 문제가 되었는지는 더 연구가 필요하다. 

 

참고

리눅스 - DNS서버 설정 파일

 

'Programming' 카테고리의 다른 글

UX/I 탐구 - 업데이트 안내  (0) 2026.02.15
Rocky Linux 10.0 도커 설치 오류 해결  (0) 2025.08.22
TIL  (0) 2024.09.20
헤드 퍼스트 디자인 패턴  (0) 2022.08.15
<구글 엔지니어는 이렇게 일한다>  (0) 2022.08.12