Sunday, March 19, 2023

Install Docker and Portainer inside Debian LXC inside Proxmox

Start with a base Debian server, then update sources repository:
apt-get update

Installing pre-requisites:
apt-get install ca-certificates
apt-get install curl
apt-get install gnupg
apt-get install lsb-release

Get the official Docker GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add the Docker Repository to the sources.list.d directory:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update

Install Docker Engine:
apt-get install docker-ce docker-ce-cli
apt-get install containerd.io

Install Portainer:
apt-get install docker.io

Enable (as part of start-up sequence) and Start Docker:
systemctl enable docker
systemctl start docker
systemctl status docker

Download, Install and Run Portainer:
docker run -d \
--name="portainer" \
--restart on-failure \
-p 9000:9000 \
-p 8000:8000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest

Debian Server initial setup commands

Each time I setup a new Debian Server, I always do the same initial commands.  These commands will set the locale, date & time and base softwares.


SETTING LOCALE

dpkg-reconfigure locales


SETTING TIMEZONE

timedatectl
timedatectl list-timezones
timedatectl set-timezone Region/Location
for example: timedatectl set-timezone America/Chicago


UPDATING APT

apt-get update


UPGRADING OPERATING SYSTEM

apt-get upgrade
reboot
apt-get dist-upgrade


INSTALLING BUILD ESSENTIAL

apt-get install build-essential
apt-get install software-properties-common