mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 07:30:24 +00:00
firewall for Docker
This commit is contained in:
parent
6b9a448463
commit
4fc0732fc7
2 changed files with 19 additions and 1 deletions
|
@ -194,7 +194,7 @@ install_backends() {
|
|||
fi
|
||||
|
||||
container_names=$(docker ps -a --format "{{.Names}}" --filter "name=websoft9")
|
||||
sudo docker compose down
|
||||
sudo docker compose -p websoft9 down
|
||||
|
||||
# delete some dead containers that docker compose cannot deleted
|
||||
if [ ! -z "$container_names" ]; then
|
||||
|
|
|
@ -113,6 +113,22 @@ fi
|
|||
}
|
||||
|
||||
|
||||
Set_Firewall(){
|
||||
echo "$echo_prefix_cockpit Set Firewalld for Docker"
|
||||
if command -v firewall-cmd &> /dev/null; then
|
||||
if ! systemctl is-active --quiet firewalld; then
|
||||
sudo systemctl start firewalld
|
||||
sudo firewall-cmd --zone=trusted --remove-interface=docker0 --permanent
|
||||
sudo firewall-cmd --reload
|
||||
sudo systemctl stop firewalld
|
||||
else
|
||||
sudo firewall-cmd --zone=trusted --remove-interface=docker0 --permanent
|
||||
sudo firewall-cmd --reload
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
Set_Docker(){
|
||||
# should have Docker server and Docker cli
|
||||
if docker_exist; then
|
||||
|
@ -121,6 +137,7 @@ if docker_exist; then
|
|||
sudo systemctl restart docker
|
||||
if ! docker network inspect websoft9 > /dev/null 2>&1; then
|
||||
sudo docker network create websoft9
|
||||
sudo systemctl restart docker
|
||||
fi
|
||||
else
|
||||
echo "Docker settings failed, exit..."
|
||||
|
@ -129,4 +146,5 @@ fi
|
|||
}
|
||||
|
||||
Upgrade_Docker
|
||||
Set_Firewall
|
||||
Set_Docker
|
Loading…
Reference in a new issue