Docker
From Briki
Useful Commands
- docker ps -a
- List all containers
- docker container inspect <container>
- Show details of <container>
- docker logs <container>
- Show logs for <container>
- docker exec -it <container> /bin/bash
- Start an interactive shell in <container>
Updating container
sudo docker run --rm -v /var/run/docker.sock:/var/run/docker.sock taisun/updater --oneshot <container>
Containers
Plex
sudo docker run -d --name plex --network=host -e PLEX_UID=111 -e PLEX_GID=127 -e TZ=Europe/London -e PLEX_CLAIM=<CLAIM_TOKEN> \ -v /var/lib/plexmediaserver:/config -v /var/media:/var/media \ --restart unless-stopped \ plexinc/pms-docker:plexpass
Tautulli (Plex Monitoring/Notifications)
sudo docker run -d --name tautulli -e PUID=127 -e PGID=138 -e TZ=Europe/London \ -p 8181:8181 \ -v /var/lib/torrent/tautulli/config:/config -v /var/lib/plex/Library/Logs:/logs \ --restart unless-stopped \ linuxserver/tautulli
Jackett (Torrent Gateway)
sudo docker run -d --name=jackett -e PUID=127 -e PGID=138 -e TZ=Europe/London \ -p 9117:9117 \ -v /var/lib/torrent/jackett/config:/config -v /var/lib/torrent/jackett/downloads:/downloads \ --restart unless-stopped \ linuxserver/jackett
Radarr (Movie Downloads)
sudo docker run -d --name radarr -e PUID=127 -e PGID=138 -e TZ=Europe/London \ -p 7878:7878 \ -v /var/lib/torrent/radarr/config:/config -v /var/media/videos/programs/movies:/movies -v /var/media/incoming/torrents/deluge:/downloads \ --restart unless-stopped \ linuxserver/radarr
Sonarr (TV Downloads)
sudo docker run -d --name=sonarr -e PUID=127 -e PGID=138 -e TZ=Europe/London \ -p 8989:8989 \ -v /var/lib/torrent/sonarr/config:/config -v /var/media/videos/programs/tv:/tv -v /var/media/incoming/torrents/deluge:/downloads \ --restart unless-stopped \ linuxserver/sonarr
Unifi
sudo docker run -d --name=unifi-controller -e PUID=140 -e PGID=150 \ -p 3478:3478/udp -p 10001:10001/udp -p 18080:18080 -p 18081:18081 -p 18443:18443 -p 18880:18880 -p 6789:6789 \ -v /var/lib/unifi:/config \ --restart unless-stopped \ linuxserver/unifi-controller
Home-Assistant (as part of host network)
sudo docker run --init -d --name=home-assistant -e TZ=Europe/London \ --net=host \ -v /var/lib/homeassistant/config:/config -v /etc/ssl/bretts.org:/etc/ssl/bretts.org -v /var/www/html/arlo-snapshots:/arlo-snapshots \ --restart unless-stopped \ homeassistant/home-assistant
Home-Assistant (with dedicated IP)
sudo docker network create -d macvlan \ --gateway 192.168.1.1 --subnet 192.168.1.0/24 --ip-range 192.168.1.231/29 -o parent=eth0 \ docker-subnet sudo docker run --init -d --name=home-assistant -e TZ=Europe/London \ --net docker-subnet --ip 192.168.1.231 \ -v /var/lib/homeassistant/docker:/config -v /var/www/html/arlo-snapshots:/arlo-snapshots \ --restart unless-stopped \ homeassistant/home-assistant
Atlassian
JIRA
Note: In this instance JIRA is configured (with `-v`) using a named volume, rather than a bind mount
sudo docker volume create --name jira sudo docker run -d --name=jira \ -p 7980:8080 \ -v jira:/var/atlassian/application-data/jira \ --restart unless-stopped \ atlassian/jira-software
Tips / Fixes
Tautulli slow to start
This may be due to an attempt to chown a large number of files. Login to the container:
sudo docker exec -it <container> /bin/bash
Disable the chown step by editing /etc/cont-init.d/30-config
and commenting out the chown command.
Adding an SSL cert for Unifi
sudo openssl pkcs12 -export -inkey /etc/ssl/bretts.org/key.pem -in /etc/ssl/bretts.org/fullchain.pem -out /tmp/cert.p12 -name unifi -password pass:temppass sudo keytool -importkeystore -deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore /var/lib/unifi/data/keystore -srckeystore /tmp/cert.p12 -srcstoretype PKCS12 -srcstorepass temppass -alias unifi -noprompt sudo docker restart unifi-controller sudo rm /tmp/cert.p12
Local DNS resolution fails on docker 18.09
This may be the result of a bug: https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1820278. Normally the container's /etc/resolv.conf should mirror that of the host, but in this case it seems to just be a default version. As a workaround, create /etc/docker/daemon.json with the following contents:
{ "dns": ["192.168.1.1", "8.8.8.8"], "dns-search": ["bretts.org"] }