I started to learn docker recently. After I install the docker,and I input sudo docker run hello-world to check does it install successfully, it shows as the title. By the way,when I input docker version, it shows the version that I installed.
Asked
Active
Viewed 968 times
1
-
2Be aware docker cli != docker daemon, when you ask docker for version - you're working with cli, to connect to docker daemon you have to start daemon first – stck Mar 16 '21 at 08:03
3 Answers
2
Sounds like you've only installed docker but haven't started the docker daemon. On most distros, you can use systemctl:
sudo systemctl start docker # to start the service
sudo systemctl enable docker # to autostart on boot
tdy
- 26,545
- 9
- 43
- 50
0
I would suggest sometimes add more permissions to /var/run/docker.sock, like that:
chmod 666 /var/run/docker.sock
Vova
- 2,425
- 2
- 9
- 18
0
First
Check if you have the daemon :
sudo systemctl list-units | grep -i docker
If you had, check the status:
sudo systemctl status docker
Second Start and enable it as @tdy answered.
sudo systemctl start docker # to start the service sudo systemctl enable docker # to autostart on boot
if you did not have it check Configure and troubleshoot the Docker daemon for more.
Shakiba Moshiri
- 16,284
- 2
- 23
- 38
-
The code doesnt run, because my ubuntu only can run sysvinit codes rather than systemd, could you write another form of the codes – 李jungle Mar 16 '21 at 11:40