As per the norm, I will skip the bumf and jump straight in to the process I used as you should know what you are doing, if not go off learn and come back
- Install Ubuntu Server 18.04 LTS:
- Download here: https://www.ubuntu.com
- If not installed during Setup, Install the following:
- OpenSSH Server: Instructions here
- Samba: Instructions here
- Standard Utilities: sudo apt-get install ubuntu-standard
- Udev (required for Plex & LiveTV: sudo apt-get install udev
- Update to ensure everything is the latest
- sudo apt-get update
- sudo apt-get upgrade
- Install Docker:
- sudo su
-
apt-get install apt-transport-https ca-certificates curl software-properties-common
-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
-
add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
- apt-get update
- apt-get install docker-ce
- docker run hello-world
- Install Docker Compose:
- Check latest version here – https://github.com/docker/compose/releases and change version in next step
-
sudo curl -L https://github.com/docker/compose/releases/download/1.25.0-rc2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose
- type “exit” to exit su mode
- sudo usermod -aG docker ${USER}
- type “id” hit enter and note the uid of your user & gid of docker
- type “cd ~ ; pwd” hit enter and note location of user directory
- sudo nano /etc/environment
- Replace/Configure & save with the following:
“PUID” & “PGID” as listed above
“TZ” as listed here
“USERDIR” of the docker user
“MYSQL_ROOT_PASSWORD” for MariaDB and phpMyAdmin
PUID=1000 PGID=1000 TZ="Europe/London" USERDIR="/home/<USERNAME>" MYSQL_ROOT_PASSWORD="password"
-
- Type “exit” hit enter and log back in
- Basic Docker & Docker Composer
- sudo mkdir ~/docker
- sudo setfacl -Rdm g:docker:rwx ~/docker
- sudo chmod -R 775 ~/docker
- Create basic Docker Compose File
- sudo nano ~/docker/docker-compose.yml
- Add the following:
version: "3.6" services: ########### # mariadb # ########### mariadb: image: linuxserver/mariadb:latest container_name: mariadb hostname: mariadb restart: always network_mode: host volumes: - ${USERDIR}/docker/mariadb:/config ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - PUID=${PUID} - PGID=${PGID} - TZ=${TZ} ############# # Portainer # ############# portainer: image: portainer/portainer:latest container_name: portainer hostname: portainer restart: always command: -H unix:///var/run/docker.sock ports: - "9000:9000" volumes: - /var/run/docker.sock:/var/run/docker.sock - ${USERDIR}/docker/portainer/data:/data - ${USERDIR}/docker/shared:/shared environment: - TZ=${TZ} ############## # watchtower # ############## watchtower: image: v2tec/watchtower container_name: watchtower hostname: watchtower restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock command: --schedule "0 0 23 * * SUN" --cleanup ############## # phpmyadmin # ############## phpmyadmin: image: phpmyadmin/phpmyadmin container_name: phpmyadmin hostname: phpmyadmin:latest restart: always links: - mariadb:db ports: - 82:82 environment: - PMA_HOST=mariadb - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
Why not check out my docker-compose.yaml here. I highly suggest installing the following:
-
-
- Portainer – Container Management
- Organizr – Tabbed web interface for all your containers
- Watchtower – Automatic Container updating
-
You may also want to check out this article here on mounting external storage if you are using Plex, ZoneMinder etc
- Starting docker compose
- sudo docker-compose -f ~/docker/docker-compose.yml up -d