mirror of
https://github.com/bashclub/proxmox-zfs-postinstall.git
synced 2024-12-26 02:00:12 +01:00
39 lines
1.4 KiB
Bash
39 lines
1.4 KiB
Bash
#!/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
|
|
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
|
|
|
|
# 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
|