From d5b372a974f17d8da5d268fa1145947518d2c57e Mon Sep 17 00:00:00 2001 From: hotio Date: Mon, 16 Jan 2017 15:39:30 +0100 Subject: [PATCH] Updated Docker container on Ubuntu 16.04 LTS (markdown) --- Docker-container-on-Ubuntu-16.04-LTS.md | 43 ++++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/Docker-container-on-Ubuntu-16.04-LTS.md b/Docker-container-on-Ubuntu-16.04-LTS.md index 86966de..0c11893 100644 --- a/Docker-container-on-Ubuntu-16.04-LTS.md +++ b/Docker-container-on-Ubuntu-16.04-LTS.md @@ -2,7 +2,7 @@ Let's start by installing docker from the Docker repository. Execute the following commands: -``` +```bash sudo apt -y install linux-image-extra-virtual sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list sudo apt update && sudo apt -y install docker-engine @@ -10,11 +10,13 @@ sudo apt update && sudo apt -y install docker-engine # Create systemd service file -`sudo nano /etc/systemd/system/docker-radarr.service` +```bash +sudo nano /etc/systemd/system/docker-radarr.service +``` Copy/Paste the following into nano: -``` +```systemd [Unit] Description=Radarr container Requires=docker.service @@ -30,9 +32,15 @@ ExecStop=/usr/bin/docker stop radarr WantedBy=multi-user.target ``` +Save the file using keyboard combo `Ctrl+o`, exit with `Ctrl+x` and set permissions using the command: + +```bash +sudo chmod 644 /etc/systemd/system/docker-radarr.service +``` + Enable the service on boot and start it: -``` +```bash sudo systemctl enable docker-radarr sudo systemctl start docker-radarr ``` @@ -41,11 +49,13 @@ The first time you'll start the container it can take a while because it will ne Let's check if it's running: -`sudo systemctl status docker-radarr` +```bash +sudo systemctl status docker-radarr +``` Output should be like this if it's running OK: -``` +```bash ● docker-radarr.service - Radarr container Loaded: loaded (/etc/systemd/system/docker-radarr.service; enabled; vendor preset: enabled) Active: active (running) since ma 2017-01-16 00:29:57 CET; 14h ago @@ -70,13 +80,30 @@ jan 16 00:30:01 server docker[9946]: [services.d] done. If you like to stop the container: -`sudo systemctl stop docker-radarr` +```bash +sudo systemctl stop docker-radarr +``` # Updating the docker image Execute the following commands: -``` +```bash sudo docker pull linuxserver/radarr sudo systemctl restart docker-radarr ``` + +# Doing some cleanup + +With these commands you can do some cleanup of docker images and containers: + +```bash +# Remove leftover containers +sudo docker ps -a -f status=exited -q | xargs -r sudo docker rm + +# Remove leftover images +sudo docker images --no-trunc -q -f dangling=true | xargs -r sudo docker rmi + +# Remove dangling volumes +sudo docker volume ls -qf dangling=true | xargs -r docker sudo volume rm +``` \ No newline at end of file