proxmox-zfs-postinstall/install-docker-portainer

39 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2021-11-22 17:20:50 +01:00
#!/bin/bash
# create zfs filesystems
zfs create -o com.sun:auto-snapshot=false -o mountpoint=/var/lib/docker rpool/docker
zfs create -o com.sun:auto-snapshot=true -o mountpoint=/portainer rpool/portainer
# add docker repository
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# update package lists and install docker engine + docker-compose
apt update
2022-10-29 12:45:36 +02:00
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -qq --no-install-recommends docker-ce docker-ce-cli containerd.io
dc_version=$(wget -O - -q https://api.github.com/repos/docker/compose/releases/latest | grep -m1 "\"name\":" | cut -d'"' -f4)
wget -O /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/${dc_version}/docker-compose-linux-x86_64
chmod +x /usr/local/bin/docker-compose
2021-11-22 17:20:50 +01:00
# install portainer
cd /portainer
mkdir data
cat << EOF > /portainer/docker-compose.yml
version: '3.2'
services:
portainer:
image: portainer/portainer-ce
ports:
- "9443:9443"
- "8000:8000"
volumes:
- /portainer/data:/data
- /var/run/docker.sock:/var/run/docker.sock
restart: always
EOF
# start portainer
docker-compose up -d