|
|
|
|
1
|
#!/bin/bash
|
1
|
#!/bin/bash
|
2
|
|
2
|
|
3
|
-echo "🛠 Installing Docker and Docker Compose on Ubuntu..."
|
|
|
|
|
3
|
+echo "Installing Docker and Docker Compose on Ubuntu..."
|
4
|
|
4
|
|
5
|
# Step 1: Remove older Docker versions (if any)
|
5
|
# Step 1: Remove older Docker versions (if any)
|
6
|
sudo apt remove -y docker docker-engine docker.io containerd runc
|
6
|
sudo apt remove -y docker docker-engine docker.io containerd runc
|
|
|
|
|
38
|
sudo systemctl enable docker
|
38
|
sudo systemctl enable docker
|
39
|
sudo systemctl start docker
|
39
|
sudo systemctl start docker
|
40
|
|
40
|
|
41
|
-# Step 8: (Optional) Add current user to docker group (to avoid needing sudo)
|
|
|
|
|
41
|
+# Step 8:Add current user to docker group (to avoid needing sudo)
|
42
|
if ! groups $USER | grep -q docker; then
|
42
|
if ! groups $USER | grep -q docker; then
|
43
|
echo " Adding $USER to docker group..."
|
43
|
echo " Adding $USER to docker group..."
|
44
|
sudo usermod -aG docker $USER
|
44
|
sudo usermod -aG docker $USER
|