Step By Step How I Setup My HomeLab Docker Containers
#Docker #HomeLab #Portainer
Full steps can be found at https://i12bretro.github.io/tutorials/0467.html
Installing VirtualBox
01. Download VirtualBox https://www.virtualbox.org/wiki/Downloads
02. Download VirtualBox Extension Pack https://www.virtualbox.org/wiki/Downloads
03. Install VirtualBox, accepting the defaults
04. Install VirtualBox Extension Pack, accepting the defaults
05. Launch VirtualBox if it is not already running
Creating TurnKey Core VirtualBox VM
01. Download the TurnKey Linux Core .ova https://www.turnkeylinux.org/core
02. In VirtualBox, select File ≫ Import Appliance...
03. Click the Browse icon ≫ Navigate to and select the downloaded .ova file
04. Click Next and then Import
05. Make sure the Turnkey Core VM is selected and click Start ≫ Normal
06. Once the VM boots, enter a new root password
07. Select Skip on the TurnKey Backup and Migration screen
08. Select Skip on the System Notifications screen
09. Select Install on the Security Updates screen
10. Note the URLs and IP address for the VM ≫ Press Enter to finish the installation
Installing Docker
01. 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
01. 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
02. Once the Portainer container is downloaded and running, open a web browser and navigate to http://DNSorIP:9000
03. Set an administrator username and password ≫ Click Create user
04. Click the Docker - Manage the local Docker environment option ≫ Click Connect
05. Select Networks from the left navigation menu
06. Click the Add Network button
07. Complete the Create network form as follows:
Name: container-network
Subnet: 173.27.0.0/16
Gateway: 173.27.0.1
08. Click the Create the Network button at the bottom of the page
Adding Additional Docker Containers From Portainer UI
01. Select Containers from the left navigation menu
02. 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/
....Full steps can be found on GitHub [link at the top]
### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro