Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
# What's wrong?
콘솔에서 도커 실행시 아래와 같은 오류 발생
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
도커가 실행되지 않았을때 발생되는 오류라 실행하면 되는데, unix:///var/run/docker.sock가 무엇인지 궁금해서 찾아봤다.
# dockerd
도커 문서 (opens new window)에 언급되어 있다.
dockerd is the persistent process that manages containers
- dockerd는 컨테이너를 관리하기위한 백그라운드 프로세서
- dockerd는 docker daemon
- dockerd가 백그라운드에서 실행되는 동안 docker 명령어를 사용할 수 있다.
# dockerd - socket
The Docker daemon can listen for Docker Engine API requests via three different types of Socket: unix, tcp, and fd.
- default 타입은 unix socket type
- 오류 메시지의 unix:///var/run/docker.sock는 소켓 타입을 의미
- 도커 데몬은 기본적으로 dockerd -H /var/run/docker.sock로 실행
- 소켓타입은 -H 옵션으로 선택 가능
> Usage: docker [OPTIONS] COMMAND > -H, --host list Daemon socket(s) to connect to
# 결론
run docker는 로그없는 run dockerd이다.
systemctl start docker