Docker error response from daemon: "Conflict ... already in use by container"

marty_c picture marty_c · Jul 28, 2015 · Viewed 159.2k times · Source

I've been using Docker on my PC to run Quantum GIS with the following instructions I've found here: docker-qgis-desktop - A simple docker container that runs QGIS desktop

Everything has been running fine until last week when I started to get this error message:

Error response from daemon: Conflict. 
The name "qgis-desktop-2-4" is already in use by container 235566ae17b8. 
You have to delete (or rename) that container to be able to reuse that name.

I'm not entirely sure what this means despite searching for clues on this site. I hadn't changed anything prior to this happening and have been successfully launching the container with this command:

sudo docker run --rm --name="qgis-desktop-2-4"     -i -t     -v ${HOME}:/home/${USER}     -v /tmp/.X11-unix:/tmp/.X11-unix     -e DISPLAY=unix$DISPLAY     kartoza/qgis-desktop:latest

How can I fix this?

Answer

Dharmit picture Dharmit · Jul 28, 2015

It looks like a container with the name qgis-desktop-2-4 already exists in the system. You can check the output of the below command to confirm if it indeed exists:

$ docker ps -a

The last column in the above command's output is for names.

If the container exists, remove it using:

$ docker rm qgis-desktop-2-4

Or forcefully using,

$ docker rm -f qgis-desktop-2-4

And then try creating a new container.