Check Docker is installed or not

This commit is contained in:
2025-01-02 09:52:52 +09:00
parent 3691d31e17
commit 4c99a1c8bd
3 changed files with 48 additions and 2 deletions
+24
View File
@@ -1,5 +1,29 @@
#!/bin/bash
# Function to install Docker
install_docker() {
echo -n "Docker is not installed. Do you want to install Docker? (y/n): "
read answer
if [ "$answer" != "${answer#[Yy]}" ]; then
echo "Installing Docker..."
curl -fsSL https://get.docker.com -o get-docker.sh > /dev/null 2>&1
sudo sh get-docker.sh > /dev/null 2>&1
rm get-docker.sh > /dev/null 2>&1
# Add current user to docker group
sudo usermod -aG docker $USER
#newgrp docker
echo "Docker has been installed successfully!"
else
echo "Docker installation skipped. Please install Docker manually to use this script."
exit 1
fi
}
check_container_running() {
docker ps --format '{{.Names}}' | grep -q "^$1$"
return $?
+4
View File
@@ -5,6 +5,10 @@ function generate_password() {
}
export -f generate_password
command_exists() {
command -v "$1" >/dev/null 2>&1
}
function save_credentials() {
local WP_PROJECT_DIR=$1
local DOMAIN=$2