-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-way.sh
43 lines (36 loc) · 1.27 KB
/
docker-way.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# System utilities
sudo apt -y install apt-utils bash-completion busybox ca-certificates cron curl gnupg2 locales lsb-release nano preload screen software-properties-common ufw unzip vim wget xxd zip
# Automated Ubuntu Docker Setup Script
wget "https://raw.githubusercontent.com/DanielNoohi/ubuntu-server-docker-setup/main/docker-install.sh" -O docker-install.sh && chmod +x docker-install.sh && bash docker-install.sh
# Ask the user for the domain name
read -p "Enter your docker container name: " DOCKER_NAME
docker run \
--detach \
--name $DOCKER_NAME \
--publish 80:80 \
--volume /data:/usr/share/nginx/html \
nginx
# Check if the system needs to reboot
if [ -f /var/run/reboot-required ]; then
echo "The system needs to reboot."
# Ask for confirmation to reboot
while true; do
read -p "Do you want to reboot now? (y/n) " choice
case "$choice" in
y|Y )
echo "Rebooting now..."
sudo reboot
;;
n|N )
echo "Reboot cancelled."
break
;;
* )
echo "Invalid input. Please enter 'y' or 'n'."
;;
esac
done
else
echo "The system does not need to reboot."
fi