How to uninstall/remove docker and discourse


I need to reinstall all the package and files of the docker and discourse since I am having an issue with nginx how do I fully removed the file ?


Are you sure the issue is with nginx? Did you ever go into a docker container directly and muck with nginx? If you only messed with things outside the container, it would perhaps be best to figure out what happened and correct it. If you really want to delete it all, make a backup first if you have a live forum with content. You can simply ssh into your instance and perform these commands to wipe it all out:

sudo apt-get remove docker* 
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/www/discourse -R

That will remove the data, and docker application.


its oks coz its my first installation. so I havent started the forum yet


weird still can’t make it work :frowning:

(Jens Maier) #5

Always quote anything containing asterisks or the shell might replace it with a matching filename.

Also, the data is stored in /var/discourse and it might not delete any images or containers docker has created or downloaded; those should live in /var/lib/docker, but that’s a blind guess. (They’d not hinder or affect a new installation anyway, just fill up some disk space.)

And does apt-get know that it needs to stop containers and the docker daemon itself before uninstalling the package?


I’m not sure that matters if it’s being uninstalled.

(Jens Maier) #7

As I said, I have no idea what apt-get does in this case. Sure, it can certainly delete all the files, but quite a few processes might keep running until you manually kill them or reboot… and if the docker daemon is still listening on port 80, you’d run into errors if you tried to install a different webserver or reinstall docker and Discourse.

(Kane York) #8

Yeah, there are hooks in the .deb files to do that. They figured all that stuff out a while ago.

Though apt-get purge is what to use if you also want to remove configuration files and data.

(Harri Luuppala) #9

See commands from:


Putting all together, this is what I did (and it seemed to work):

sudo apt-get purge docker-engine
sudo rm -rf /var/lib/docker
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/discourse -R