title: docker：Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
body: <p>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 (<a href="https://docs.docker.com/engine/install/ubuntu/" rel="nofollow noreferrer">https://docs.docker.com/engine/install/ubuntu/</a>) to install docker engine on Ubuntu.</p>
  <p>when I do <code>sudo docker run hello-world</code> to verify that Docker Engine is installed correctly by running the <code>hello-world</code> image after all steps, it shows error like this:</p>
  <pre><code>docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
  See 'docker run --help'.
  </code></pre>
  <p>After that I check the <code>docker version</code>, it shows</p>
  <pre><code>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?
  </code></pre>
  <p>Then look at <code>sudo docker info</code>, which shows</p>
  <pre><code>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
  </code></pre>
  <p>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?</p>
  <p>This is history:</p>
  <pre><code>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 \
  &gt;     ca-certificates \
  &gt;     curl \
  &gt;     gnupg \
  &gt;     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 \
  &gt;   &quot;deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  &gt;   $(lsb_release -cs) stable&quot; | sudo tee /etc/apt/sources.list.d/docker.list &gt; /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'.
  </code></pre>