Installing VirtualBox
- Download VirtualBox Download
- Download VirtualBox Extension Pack Download
- Install VirtualBox, accepting the defaults
- Install VirtualBox Extension Pack, accepting the defaults
- Launch VirtualBox if it is not already running
Creating TurnKey Core VirtualBox VM
- Download the TurnKey Linux Core .ova Download
- In VirtualBox, select File > Import Appliance...
- Click the Browse icon > Navigate to and select the downloaded .ova file
- Click Next and then Import
- Make sure the Turnkey Core VM is selected and click Start > Normal
- Once the VM boots, enter a new root password
- Select Skip on the TurnKey Backup and Migration screen
- Select Skip on the System Notifications screen
- Select Install on the Security Updates screen
- Note the URLs and IP address for the VM > Press Enter to finish the installation
Installing Docker
- Execute the following commands in a terminal:
# update software repositories
apt update
# install necessary packages for https apt calls
apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# add docker GPG key
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
# add docker software repository
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
# install docker
apt update
apt install docker-ce docker-ce-cli containerd.io
# create a docker group
groupadd docker
# add the current user to the docker group
usermod -aG docker $USER
Running Portainer Docker Container
- Continue with the following commands in terminal to run Portainer:
# create a working directory for portainer
mkdir ~/docker/portainer -p
# run the portainer docker container
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v ~/docker/portainer:/data portainer/portainer-ce - Once the Portainer container is downloaded and running, open a web browser and navigate to http://DNSorIP:9000
- Set an administrator username and password > Click Create user
- Click the Docker - Manage the local Docker environment option > Click Connect
- Select Networks from the left navigation menu
- Click the Add Network button
- Complete the Create network form as follows:
Name: container-network
Subnet: 173.27.0.0/16
Gateway: 173.27.0.1 - Click the Create the Network button at the bottom of the page
Adding Additional Docker Containers From Portainer UI
- Select Containers from the left navigation menu
- For each of the containers listed below, click the Add Container button and complete the Create container form with the values given
Heimdall
Name: heimdall
Image: ghcr.io/linuxserver/heimdall:latest
Ports: 40000 → 80
Volumes: /config → /root/docker/heimdall
Env:
PUID: 1000
PGID: 1000
TZ: America/New_York
Restart Policy: Unless Stopped
MySQL
Name: MySQL
Image: mysql:latest
Ports: 3306 → 3306
Volumes: /var/lib/mysql → /root/docker/mysql
Env:
MYSQL_ROOT_PASSWORD: password
Restart Policy: Unless Stopped
phpMyAdmin
Name: phpMyAdmin
Image: phpmyadmin:latest
Ports: 40001 → 80
Env:
PMA_HOST: MySQL
Restart Policy: Unless Stopped
PostgreSQL
Name: postgres
Image: postgres:latest
Ports: 5432 → 5432
Volumes: /var/lib/postgresql/data → /root/docker/postgresql/data
Env:
POSTGRES_PASSWORD: postgres
Restart Policy: Unless Stopped
phpPGAdmin
Name: phpPGAdmin
Image: bitnami/phppgadmin:latest
Ports: 40004 → 8080
Env:
POSTGRESQL_HOST: postgresql
Restart Policy: Unless Stopped
Watchtower
Name: watchtower
Image: containrrr/watchtower:latest
Volumes: /var/run/docker.sock → /var/run/docker.sock
Env:
WATCHTOWER_NOTIFICATION_EMAIL_FROM: watchtower@i12bretro.local
WATCHTOWER_NOTIFICATION_EMAIL_TO: sysadmin@i12bretro.local
WATCHTOWER_NOTIFICATION_EMAIL_SERVER: smtp.i12bretro.local
WATCHTOWER_NOTIFICATIONS: email
WATCHTOWER_NO_STARTUP_MESSAGE: true
Restart Policy: Unless Stopped
Apache HTTPD
Name: httpd
Image: httpd:alpine
Ports: 80 → 80
Volumes: /usr/local/apache2/conf → /root/docker/apache2/conf
Restart Policy: Unless Stopped
Pi-Hole
Name: pihole
Image: pihole/pihole:latest
Ports: 53 → 53, 53 → 53 UDP, 67 → 67 UDP, 40002 → 80
Volumes:
/etc/pihole/ → /root/docker/pihole/etc/
/etc/dnsmasq.d/ → /root/docker/pihole/dnsmasq.d/
Env:
TZ: America/New_York
WEBPASSWORD: password
Restart Policy: Unless Stopped
guacd
Name: guacd
Image: guacamole/guacd:latest
Restart Policy: Unless Stopped
Completing Network Setup
- Select Containers from the left navigation menu
- Click the MySQL container
- Scroll down to the Networks section > Select container-network from the dropdown > Click Join Network
- Do the same for the phpMyAdmin, Postgres, phpPGAdmin, guacd and Guacamole containers
Creating Apache HTTPD Reverse Proxy
- Run the following command in terminal on the Docker host:
# copy the httpd.conf from container to host
docker cp httpd:/usr/local/apache2/ /root/docker/apache2
# edit httpd.conf
nano ~/docker/apache2/conf/httpd.conf - Uncomment the following module lines by removing the #
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so - Paste the following at the bottom of the file
- Press CTRL+O, Enter, CTRL+X to write the changes to httpd.conf
- Back in the Portainer UI, select Containers from the left navigation menu
- Check the box next to httpd > Click the Restart button