Docker – Cannot connect to the Docker Daemon to rm containers

Playing with ELK and docker, I needed to restart every services.

docker ps told me that I haven’t any containers up.

  • How to use sqlite3 file from different docker containers?
  • I just installed docker, but running “hello world” failed, it doesn't download image?
  • Kubernetes: Directly connecting a container to an external IP for UDP connections?
  • Caching Jar dependencies for Maven-based Docker builds
  • How to display the process id that opened a particular socket within a docker container?
  • How do I configure which DNS server docker uses in Docker for Mac?
  • docker run -it --rm [...] --name es elasticsearch -> Error response from daemon. The name "es" is already use by container [...]

    So I try to remove all container :

    docker ps -a -q | xargs docker rm -> Cannot connect to the Docker daemon. Is the docker daemon running on this host?

    The container is not up but still here.

    Of course I can simply change my container’s name but it’s not right. That mean I have container running. Even if I restart my server.

    Any idea ?

  • Docker : How to export/save classifying results outside a Docker (tensorflow) box?
  • Can Linux Container run on a virtual machine? [closed]
  • Multiple Docker images filesystem scan
  • Linking containers with Mesos JSON file
  • How to use fluentd log driver on Elastic Beanstalk Multicontainer docker
  • How does docker compare to openshift?
  • 2 Solutions collect form web for “Docker – Cannot connect to the Docker Daemon to rm containers”

    When you stop your container it’s not getting removed by default, unless you’re providing --rm flag. So, it could be so, like you have started and stopped some container with es name before and it’s stopped now. But it’s not possible to create a new container with the existing name, even if the existing one is not running. Try to use a -a flag to show all containers you have as:

    docker ps -a
    

    If you have some with the name es, just remove it manually with:

    docker rm es
    

    You also able to provide -f flag, to force removing the es container even if it’s running.

    docker rm es should do the trick. Furthermore, if you want to remove a running container, you can add the -f parameter(docker rm -f ‘container_name’)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.