Destroying docker container does not destroy the database?

So…wait for it…I destroyed my postgres and web_only containers, bootstrapped them again and hang on…what’s that? My forum is still there?!

I’m quite confused and I’m not sure what’s going on. I used one of the import scripts to import some data, but now I want a fresh install to run the script again (something wasn’t perfect first time round).

However, I cannot accomplish that. Does anybody have any ideas how my data can still be there after destroying the Postgres container and re-boostrapping?

FYI, I’m using a custom docker image but all it does extra from the main docker one is change the folder directory names and install some linux dependencies for mysql.

I’m wondering if somehow I’ve committed the data to my docker image on docker hub. But even that is just an image with my personal fork of Docker. I’m not committing postgres stuff. Hmm…

By design, all data is stored out of the container in a volume. If you insist on nuking everything, destroy your container, rm -fr /var/discourse/shared/standalone and re-boostrap.

If you run:

cd /var/docker
git pull
./launcher rebuild app

you will see the actual docker command we run.

2 Likes

not to be confused with the command ./launcher destroy app though right?

Thanks Sam. I don’t think I ever would have figured that one out.

Is this something specific to the Discourse install, or is this a Docker feature?

But yes, @brahn has a point. Shouldn’t ./launcher destroy app do this for you?

If not, I think it’s at least something to highlight on the install guides for anyone following along, as the destroy command would give the impression that you’re starting fresh.

Suggested reading:

https://meta.discourse.org/t/advanced-troubleshooting-with-docker/15927

1 Like

Oh sorry, I didn’t mean to imply that the launcher destroy should do that. I just meant to point out that using the word destroy when talking about rm the shared data/volume could have been confusing :smile:

It is a bit confusing but a key concept that you need to keep in mind with our Docker design is that containers are throw-away. I always wanted a trivial to recover scenario, for example you can even recover data if docker completely fails and so on.

destroy is a somewhat scary word, but it does really destroy the container, which you can rebuild or start again a-fresh.

1 Like

Thanks for your replies. I was already pretty confident with the Docker setup, I just wasn’t aware of the symlinked volumes and the data living on the host. Now I know! :slight_smile: