diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..850e78d --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,27 @@ +services: + ntfy: + image: binwiederhier/ntfy + container_name: ntfy-local + restart: unless-stopped + command: + - serve + environment: + - TZ=IST + user: 1000:1000 + volumes: + - /var/cache/ntfy:/var/cache/ntfy + - /etc/ntfy:/etc/ntfy + ports: + - 80:80 + healthcheck: + test: ["CMD-SHELL", "wget -q --tries=1 http://localhost:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"] + interval: 60s + timeout: 10s + retries: 3 + start_period: 40s + networks: + - ntfy + +networks: + ntfy: + driver: bridge diff --git a/docker-setup.sh b/docker-setup.sh new file mode 100755 index 0000000..5e9b696 --- /dev/null +++ b/docker-setup.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +############################################### +line="==================================" + +# Remove conflicting packages +for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done + +# Setup Docker's apt repo +# Add Docker's official GPG key: +sudo apt-get update +sudo apt-get install -y ca-certificates curl +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc +sudo chmod a+r /etc/apt/keyrings/docker.asc + +# Add the repository to Apt sources: +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update + +# Install docker +sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin +sudo systemctl start docker.socket +sudo systemctl enable docker.socket +sudo systemctl start containerd.service +sudo systemctl enable containerd.service + +# Test +sudo docker run hello-world + +# Use docker without sudo +sudo groupadd docker +sudo usermod -aG docker $USER +sudo chown $USER:docker /var/run/docker.sock + +# Show running containers +docker ps -a + +echo -e "\n$line" +echo -e "Docker setup complete." +echo -e "## Designed and Engineered by Kshitij" +echo -e "$line\n"