Unable to start postgres docker container from docker-compose
The problem caused because the volume which your compose created to store your database still keep old data which initiated by PostgreSQL 9.6
. That volume name is postgres-data
which created when you use named volume on your docker-compose.yml
. So simply to get rid of this, you can use some ways below:
- Using
docker-compose
command:
Run docker-compose down -v
, this will stop all your container inside that compose and remove all named volume inside that compose.
You could take a look at docker-compose down command
- Using
docker volume
command:
Run docker volume ls
to get list of current volumes on your machine, I think you will see your volume on that list too:
DRIVER VOLUME NAMElocal postgres-data
Run docker volume rm postgres-data
to remove that volume, if your container still running and you couldn't remove it then you can use -f
to force remove it
Hope that helps!