title: How to remove dangling images in Docker
body: <p>How can I remove dangling Docker images? I tried </p>
  
  <pre><code>sudo docker rmi $(docker images -f "dangling=true" -q)
  </code></pre>
  
  <p>but it shows</p>
  
  <blockquote>
    <p>Got permission denied while trying to connect to the Docker daemon
    socket at unix:///var/run/docker.sock: Get
    <a href="http://%2Fvar%2Frun%2Fdocker.sock/v1.35/images/json?filters=%7B%22dangling%22%3A%7B%22true%22%3Atrue%7D%7D" rel="noreferrer">http://%2Fvar%2Frun%2Fdocker.sock/v1.35/images/json?filters=%7B%22dangling%22%3A%7B%22true%22%3Atrue%7D%7D</a>:
    dial unix /var/run/docker.sock: connect: permission denied</p>
  </blockquote>