Using this method, you can be safe in knowing that even if you accidentally run docker rm <container_id> that you can restart PostgreSQL again and have all of you data just as you left it previously.
Hope this helps!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I agree with Marcos...nice article J Shree! :-)
It might also be helpful to show folks how to save their data even after running
docker rm <container_id>
. This is how I normally accomplish this:First, create a local directory to hold the data:
Then start PostgreSQL using a volume mount so the container will store the data in this newly created local directory:
Using this method, you can be safe in knowing that even if you accidentally run
docker rm <container_id>
that you can restart PostgreSQL again and have all of you data just as you left it previously.Hope this helps!