update
This commit is contained in:
parent
de20bbd4ab
commit
8f70ddc2ce
@ -2,11 +2,11 @@
|
||||
|
||||
restart_docker(){
|
||||
# 如果docker容器没有启动, 则退出
|
||||
local container_status=$(docker-compose -f ./docker-compose.yml ps -q | xargs docker inspect -f '{{.State.Running}}')
|
||||
if [ -z "$container_status" ] || [ "$container_status" != "true" ]; then
|
||||
local running_count=$(docker-compose -f ./docker-compose.yml ps -q | wc -l)
|
||||
if [ "$running_count" -eq 0 ]; then
|
||||
echo "容器未启动, 无需重启"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "正在重启容器..."
|
||||
docker-compose -f ./docker-compose.yml down
|
||||
|
||||
Loading…
Reference in New Issue
Block a user