본문 바로가기
devops/docker

WSL2 ubuntu 22.04 인스턴스에 docker 설치 에러 (Cannot connect to the Docker daemon)

by anjulia 2023. 4. 15.

 

도커 버전은 확인이 되는데, 도커의 데몬프로세스를 연결할 수 없다는 에러가 발생했다. 

 

 

 

 

아래 명령어를 입력 후 '1'을 입력하고 엔터를 친다. 

 

sudo update-alternatives --config iptables

 

 

하지만 docker 서비스를  실행할 수 없다. 

 

 

 

다시 아래 명령어를 입력한다. 

nohup sudo dockerd &

 

sudo docker run hello-world

 

docker가 hello-world라는 파일을 실행하기 위해서는 아래와 같은 단계를 수행한다. 

 

 

  1. Docker 클라이언트가 Docker 데몬에 접속했습니다.
  2. Docker 데몬은 Docker 허브에서 "hello-world" 이미지를 가져왔습니다.
    (amd64)

  3. Docker 데몬은 해당 이미지에서 현재 읽고 있는 출력을 생성하는 실행 파일을 실행하는 새 컨테이너를 만들었습니다 .
  4. Docker 데몬은 해당 출력을 Docker 클라이언트로 스트리밍하여
    터미널로 보냈습니다.

 

현재 가동중인 컨테이너를 출력한다. 

docker ps

 

docker 클라이언트가 docker demon에 접속하지 못해서 발생한 문제라고 생각된다.

 

 

 

참고 

 

https://github.com/docker/for-linux/issues/1406

 

Failure to install and run Docker in WSL Ubuntu 22.04 (works in 20.04): "Cannot connect to the Docker daemon" · Issue #1406 ·

This is a bug report This is a feature request I searched existing issues before opening this one Steps to reproduce the behavior OS: Windows 10 21H2 Enabled features: Virtual Machine Platform, Win...

github.com