2

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 ?
user3668129
  • 4,318
  • 6
  • 45
  • 87

2 Answers2

4

Check this (shows all containers, includes stopped)

sudo docker ps -a

And then delete container

docker rm CONTAINER
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.

Dashrath Mundkar
  • 7,956
  • 2
  • 28
  • 42