Docker Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

问题:Docker 不能连接到Docker daemon

➜  ~ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

尝试:

➜  ~ docker --version
Docker version 24.0.5, build ced0996

➜  ~ systemctl status docker
Unit docker.service could not be found.
➜  ~ service docker start
Failed to start docker.service: Unit docker.service not found.

➜  ~ sudo snap restart docker     
Restarted.

➜  ~ sudo snap restart docker     
Restarted.

➜  ~ docker ps                    
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

问题依旧。

简单粗暴解决问题:

➜  ~ sudo apt update

➜  ~ sudo apt install snap

➜  ~ sudo apt install snapd

➜  ~ snap version         
snap    2.63+24.04ubuntu0.1
snapd   2.63+24.04ubuntu0.1
series  16
ubuntu  24.04
kernel  6.8.0-39-generic

➜  ~ sudo snap install docker
snap "docker" is already installed, see 'snap help refresh'
➜  ~ sudo snap remove docker
docker removed
➜  ~ docker --version
zsh: command not found: docker
➜  ~ sudo snap install docker
docker 24.0.5 from Canonical✓ installed
➜  ~ docker --version        
Docker version 24.0.5, build ced0996
➜  ~ docker ps       
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

问题被解决

➜   docker load -i postgres-amd64.tar
32148f9f6c5a: Loading layer [==================================================>]  77.83MB/77.83MB
2febc3cec600: Loading layer [==================================================>]  12.29kB/12.29kB
98b4fd455e29: Loading layer [==================================================>]  10.15MB/10.15MB
ea82396fdd8b: Loading layer [==================================================>]   4.18MB/4.18MB
6fe3e3292714: Loading layer [==================================================>]  25.77MB/25.77MB
5315c3df12f9: Loading layer [==================================================>]  3.283MB/3.283MB
f41901ea8af1: Loading layer [==================================================>]  1.536kB/1.536kB
ae30ae1dd378: Loading layer [==================================================>]   7.68kB/7.68kB
2b156f460110: Loading layer [==================================================>]  317.9MB/317.9MB
9bdc906b5652: Loading layer [==================================================>]  68.61kB/68.61kB
2c0fbe902cd1: Loading layer [==================================================>]  2.048kB/2.048kB
b4cedb2b78c0: Loading layer [==================================================>]  3.072kB/3.072kB
041ead7261db: Loading layer [==================================================>]  18.94kB/18.94kB
b75d4ea7f128: Loading layer [==================================================>]  3.072kB/3.072kB
Loaded image: postgres:latest
➜  dockerImage docker ps           

你可能感兴趣的:(docker,容器,ubuntu)