Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.
- Docker Compose
- Portainer 2.0 Update
- Install Snapdrop using Compose
- Install Droppy with Docker Compose
- Backup Docker Containers using Resilio Sync
- DashMachine 0.7 with Code Server
- Install Wordpress using Docker Compose
- Docker Run
- Guacamole Remote Desktop Client
- Intall Watchtower with E-Mail (Gmail) Notifications
- Install Glances to Monitor Docker Containers (with web interface)
- Installing Docker
The Compose file provides a way to document and configure all of the application's service dependencies (databases, queues, caches, web service APIs, etc). Using the Compose command line tool you can create and start one or more containers for each dependency with a single command.
Portainer 2.0 Update
Use this compose to update to Portainer 2.0
version: '2' services: portainer: image: portainer/portainer-ce command: -H unix:///var/run/docker.sock restart: always ports: - 9001:9000 volumes: - /var/run/docker.sock:/var/run/docker.sock - portainer_data:/data
Install Snapdrop using Compose
Use this compose stack to install Snapdrop. Change ports as needed. More information can be found here.
--- version: "2.1" services: snapdrop: image: linuxserver/snapdrop container_name: snapdrop environment: - PUID=1000 - PGID=1000 - TZ=Europe/London ports: - 80:80 - 443:443 restart: unless-stopped
Install using Portainer
- Click on Stacks
- Give the stack a name
- Paste the compose script above into the stacks editor on Portainer
- Make any changes to ports (if necessary)
What is Snapdrop?
Install Droppy with Docker Compose
Droppy is a self-hosted file storage server with a web interface and capabilities to edit files and view media directly in the browser. It is particularly well-suited to be run on low-end hardware like the Raspberry Pi.
- Responsive, scalable HTML5 interface
- Realtime updates of file system changes
- Directory and Multi-File upload
- Drag-and-Drop support
- Clipboard support to create image/text files
- Side-by-Side mode
- Simple and fast Search
- Shareable public download links
- Zip download of directories
- Powerful text editor with themes and broad language support
- Image and video gallery with touch support
- Audio player with seeking support
- Fullscreen support for editor and gallery
- Supports installing to the homescreen
- Docker images available for x86-64, ARMv6, ARMv7 and ARMv8
Install Droppy file manager using this compose stack. Change ports or volumes as needed. See the Droppy GitHub repo for more details.
version: '2' services: droppy: container_name: droppy image: silverwind/droppy ports: - 8989:8989 volumes: - /docker/Droppy:/config - /docker/Droppy/files:/files restart: unless-stopped
Backup Docker Containers using Resilio Sync
Resilio Sync is a proprietary peer-to-peer file synchronization tool available for Windows, Mac, Linux, Android, iOS, Windows Phone, Amazon Kindle Fire and BSD.
Resilio Sync can be used to copy your docker container files from one machine to another either locally or anywhere in the world. You will need to install Resilio Sync on both machines. My Docker host is on a VM and the backups are sent to my Synology NAS which also runs Resilio Sync. For Synology users, Resilio Sync can be installed as a Package or as a Docker container. I prefer the Docker container but both will work. For the Docker host machine I only use... well, the docker container of-course.
One thing to note is Resilio Sync is NOT a backup tool but a syncing tool. Whatever your host machine pulls in, your backup machine will too. Keep that in mind when it comes to downloading files that you have no idea might contain threats to your system.
Install Resilio Sync
Install the LinuxServer Resilio Sync Docker container on your Docker host. I use this compose file.
--- version: "2.1" services: resilio-sync: image: linuxserver/resilio-sync container_name: resilio-sync environment: - PUID=1000 - PGID=1000 - TZ=Europe/London - UMASK_SET=022 volumes: - path to config:/config - path to downloads:/downloads - /:/sync ports: - 8888:8888 - 55555:55555 restart: unless-stopped
I prefer Compose because I use Portainer and Yacht to control my stacks.
Make changes to the ports, IDs and volumes as needed. Notice I bind "/" to"/sync", this allows you to browse your whole machine for folders to sync.
Repeat the same process on your Docker Backup machine.
Setup Resilio Sync
When you first load the UI you will be prompted to setup a username and password. Then assign a machine name. This name will be used so you can identify which machine is syncing to the folders you share. It's good if you have multiple machines syncing files.
Now on your Docker host Resilio Sync instance, you need to add a folder to share out. This should be the folder where you store your Docker container/s.
Click the plus in the upper left and add a standard folder.
My container files happen to be in my root directory. This is where my Wordpress files are stored for my Wordpress container.
Select the folder then click open. You will get a prompt to share your folder. Close that because we are not ready to do that yet.
I created a new folder called Family Portal and that is where I want the files from my Docker host to go to. Now it's time to sync the filse from your host to your backup machine.
Go back to your Docker host Resilio Sync instance and right click om the folder you just setup and click the share option.
This will give you some different ways to sync your files to the backup machine.
I like to do "read only" syncing because this will make it so the backup machine cannot delete files from the host machine. So if you accidentally delete the files on your backup machine it wont delete them on the host machine too! Once you've made that mistake it only takes one time before you use read only lol.
Click on Key and copy the Read Only link then go back to your backup machine instance of Resilio Sync.
Click on the plus icon in the upper left corner again and this time click on Enter a key or link.
A new window will pop up where you enter the key and press ok. Then you need to browse for the folder you made on your backup machine to sync the files. I made the Family Portal folder so that's the folder I chose. Then click open.
Your files should now begin downloading to the backup machine and will do so every time a new file is added or changed.
Resilio Sync is very low maintenance. It's pretty much set it and forget it. However, it's always good to peek in and make sure your connections are still working from time to time.
DashMachine 0.7 with Code Server
--- version: "2.1" services: dashmachine: image: rmountjoy/dashmachine0.7:latest container_name: dashmachine environment: - PUID=1000 - PGID=1000 - TZ=America/Detroit - EDITOR_URL=https://your-reverse-proxy.url volumes: - /config/directory:/DashMachine/config ports: - 5000:5000 restart: unless-stopped code-server: image: linuxserver/code-server:latest container_name: code-server environment: - PUID=1000 - PGID=1000 - TZ=America/Detroit - PASSWORD=mysecretpassword - SUDO_PASSWORD=mysecretpassword - PROXY_DOMAIN=your-reverse-proxy.url volumes: - /config/directory:/config - /config/directory/workspace:/config/workspace/Dashmachine ports: - 8443:8443 restart: unless-stopped
Install Wordpress using Docker Compose
This stack can be used to install Wordpress with a MySQL DB. Change the ports and volume binds as you need.
version: '2' services: db: image: mysql:5.7 volumes: - /wordpress/db:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: wordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: image: wordpress:latest ports: - 8977:80 restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress volumes: - /home/usr/wordpress:/var/www/html volumes: db_data:
Docker runs processes in isolated containers. A container is a process which runs on a host. The host may be local or remote. When an operator executes docker run, the container process that runs is isolated in that it has its own file system, its own networking, and its own isolated process tree separate from the host.
Guacamole Remote Desktop Client
Use this command to install Guacamole Remote Desktop Client. Change the port and volume bind location if needed.
docker run \ -p 8080:8080 \ -v /guacamole:/config \ oznu/guacamole
Take back control with Matomo – a powerful web analytics platform that gives you 100% data ownership.
Matomo is used to gather analytics on The Homelab Wiki
See the official GitHub repo for more information.
Use the following command to install Matomo. Change the port and volume as needed.
docker run -d -p 8000:8000 --name matomo \ -v /home/usr/matomo/data:/data \ crazymax/matomo:latest
Intall Watchtower with E-Mail (Gmail) Notifications
Use the following code to install watchtower with gmail notifications. See more information and documentation here.
sudo docker run -d \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ -e WATCHTOWER_NOTIFICATIONS=email \ -e WATCHTOWER_NOTIFICATION_EMAIL_FROMemail@example.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_TOfirstname.lastname@example.org \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USERemail@example.com \ -e WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=your-email-password \ -e WATCHTOWER_NOTIFICATION_EMAIL_DELAY=2 \ containrrr/watchtower
Without email notifications
sudo docker run -d \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower
Install Glances to Monitor Docker Containers (with web interface)
Glances can be installed through Docker, allowing you to run it without installing all the python dependencies directly on your system. Once you have [docker installed](https://docs.docker.com/install/), you can
Run the following command to install Glances with a web interface. See more information here.
sudo docker run -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host docker.io/nicolargo/glances
Different ways to install Docker on your preferred Operating System.
Installing Docker on Ubuntu
Installing Docker on Ubuntu is simple. Run the following commands separately.
sudo apt install docker.io sudo systemctl enable docker sudo systemctl start docker sudo systemctl status docker
This will ensure docker will run when you restart your system or server.