I'm running postgress inside a docker container. I'm trying to completely remove it and re-install.
Everytime I start it seems to be 'restarting' rather than making a fresh instance.
When I re-start the new instance I get a message like this telling me when I last shut down the previous database:
postgres | LOG: database system was shut down at 2017-04-25 18:28:02 UTC
These are the steps I took in an attempt to completely remove the database.
docker kill $(docker ps -q) # stop all containers docker rm $(docker ps -a -q) # remove all containers docker rmi $(docker images -q) # remove all images docker network prune # remove all networks docker volume prune # remove all volumes
Yet I always get the log indicating when the previous database was shutdown. How can I completely remove all traces of the database?
For docker-compose
the correct way to remove volumes would be docker-compose down --volumes
or docker-compose down --rmi all --volumes
.
For more information see https://docs.docker.com/compose/reference/down/.
You can try:
docker volume rm $(docker volume ls -q)
Otherwise, the proper way to do it would be to do:
docker rm -f -v postgres_container_name
However, I don't think the volumes are the issue. When you do a docker run --rm -it postgres
the entrypoint loads some configuration and restarts the database, so it is expected to see that message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With