added docker installation script and docker compose for ntfy local
This commit is contained in:
parent
382683efe1
commit
c8ffb92f82
27
docker-compose.yaml
Normal file
27
docker-compose.yaml
Normal file
@ -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
|
45
docker-setup.sh
Executable file
45
docker-setup.sh
Executable file
@ -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"
|
Loading…
Reference in New Issue
Block a user