vm-setup/docker-rocky.sh
2024-07-01 21:35:20 +02:00

43 lines
1.1 KiB
Bash

#!/bin/bash
cd /root
#update script
cat >> update.sh << 'END'
#!/bin/bash
cd /root
docker compose build --pull
docker compose pull
docker compose up --detach --force-recreate --build
docker image prune -f
docker system prune -f
END
chmod +x update.sh
ln -s /root/update.sh /etc/cron.weekly/update_docker
touch docker-compose.yml
dnf install -y 'dnf-command(config-manager)'
# install docker
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
dnf install -y docker-ce docker-compose-plugin
systemctl start docker
systemctl enable docker
#autoheal
docker run -d \
--name autoheal \
--restart=always \
-e AUTOHEAL_CONTAINER_LABEL=all \
-v /var/run/docker.sock:/var/run/docker.sock \
willfarrell/autoheal
echo "PLEASE RERUN AUTOHEAL WITH NOTIFICATION WEBHOOK!!!"
echo "docker run -d \"
echo " --name autoheal \"
echo " --restart=always \"
echo " -e AUTOHEAL_CONTAINER_LABEL=all \"
echo " -e WEBHOOK_URL=WEBHOOK_URL_IN_QUOTES \"
echo " -v /var/run/docker.sock:/var/run/docker.sock \"
echo " willfarrell/autoheal"