From 5e633f23b222bf7542ecf8ef0dea2f37d924ea7f Mon Sep 17 00:00:00 2001 From: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com> Date: Fri, 3 May 2019 09:58:00 +0200 Subject: [PATCH] Adding systemd service update commands and auto cleaning old, unused images. --- Updating-the-bitwarden-image.md | 42 ++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Updating-the-bitwarden-image.md b/Updating-the-bitwarden-image.md index eb0b81d..3604003 100644 --- a/Updating-the-bitwarden-image.md +++ b/Updating-the-bitwarden-image.md @@ -33,4 +33,44 @@ docker run -d --volumes-from bitwarden_data --name bitwarden -p 80:80 mprasil/bi docker rm bitwarden_data # Alternatively you can keep data container around for future updates in which case you can skip last step. -``` \ No newline at end of file +``` + + +Updating when using systemd service (in this case Debian/Rasbian) + +``` +Sudo systemctl restart bitwarden.service +Sudo docker prune -f +#WARNING this could delete stopped or unused containers, etc. not associated with bitwarden_rs +#be carefull and look which containers you need +docker ps -a +shows stopped containers +#WARNING! This will remove: +# - all stopped #containers +# - all networks not used by at least one container +# - all dangling images +# - all dangling build cache +#you can list docker images with +docker images +#there you see all unused images +# +``` +The restart command will stop the container, pull the newest images, run the container again. +The prune command will remove the now old container (-f stands for: Do not ask for confirmation). + +Put these into cronjob if you want (time can be changed): +``` +Sudo crontab -e +0 2 * * * sudo systemctl restart bitwarden.service + +0 3 * * * sudo /usr/bin/docker system prune -f +``` +Use +``` +docker which +``` +If +``` +/usr/bin/docker +``` +is not the correct path to docker \ No newline at end of file