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.

  • docker: why are images per machine?
  • OS name for docker images
  • Docker PostgreSQL - Scripts in /docker-entrypoint-initdb.d doesn't run
  • Docker: Unable to execute RUN command after ADD when starting from scratch
  • Building Dockerfile fails when touching a file after a mkdir
  • Docker Compose run that takes user input crashes with “broken pipe”
  • 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 ?

  • How to install Cloud Foundry CLI on Ubuntu
  • Cannot access nginx url within container
  • Mounting volumes on Bluemix containers and sharing between them does not work
  • For multiple projects using Docker, use Multiple VMs or Single Host with multiple containters
  • Docker run vs create
  • Docker with make: build image on Dockerfile change
  • 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.