I'm remotely connecting to a school server (Ubuntu 20.04.2 LTS) through Visual Studio Code (VScode, version 1.66) to perform some tasks, and today I follow docker.com (https://docs.docker.com/engine/install/ubuntu/) to install docker engine on Ubuntu.
when I do sudo docker run hello-world
to verify that Docker Engine is installed correctly by running the hello-world
image after all steps, it shows error like this:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
After that I check the docker version
, it shows
Client: Docker Engine - Community
Version: 20.10.14
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 24 01:48:02 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Then look at sudo docker info
, which shows
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.1-docker)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
After I unstall and reinstall docker follow this tutorial, it still shows such an error, I think I need to follow the server side of docker, but I don't know how to do it?
This is history:
root@yp:~# sudo apt-get remove docker docker-engine docker.io containerd runc
...
root@yp:~# sudo apt-get update
...
root@yp:~# sudo apt-get install \
> ca-certificates \
> curl \
> gnupg \
> lsb-release
...
root@yp:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
...
root@yp:~# echo \
> "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
...
root@yp:~# sudo apt-get update
...
root@yp:~# sudo apt-get install docker-ce docker-ce-cli containerd.io
...
root@yp:~# sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
CodePudding user response:
You should first start and enable docker in systemctl
systemctl start docker
systemctl enable docker