skip to Main Content

I’m trying to run postgres docker:

docker run --name some-postgres -e POSTGRES_PASSWORD=123456 -d postgres

I’m getting error message:

docker: Error response from daemon: Conflict. The container name "/some-postgres" is already in use by container "93b72872c89cf7497872b0bc0e98d5a91078666945e3ca39ce5cbb36c436b5af". You have to remove (or rename) that container to be able to reuse that name.

I checked with:

sudo docker ps

And there is nothing:

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

(Empty)

  1. so, why I’m getting this error message ?
  2. If the container name already exsits, How can I run it ?

2

Answers


  1. Try running

    docker ps -a you will see existing container name and remove that using docker rm some-postgres. and run the docker run command again.

    Login or Signup to reply.
  2. Check this (shows all containers, includes stopped)

    sudo docker ps -a
    

    And then delete container

    docker rm CONTAINER
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search