增加远程脚本
This commit is contained in:
parent
771abcf074
commit
f2be5c8720
3
bin/remote/README.md
Normal file
3
bin/remote/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## 说明
|
||||||
|
|
||||||
|
这个文件夹的文件用于被其他主机(本地电脑)远程调用. 不要导入使用.
|
||||||
28
bin/remote/update_docker_images.sh
Normal file
28
bin/remote/update_docker_images.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
update_docker_images(){
|
||||||
|
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../" # 脚本文件绝对路径
|
||||||
|
local docker_compose_file="$script_dir/../docker-compose.yml" # docker-compose.yml文件路径
|
||||||
|
|
||||||
|
# 检查是否存在 docker-compose.yml 文件
|
||||||
|
if [ ! -f $docker_compose_file ]; then
|
||||||
|
echo "Error: docker-compose.yml 文件不存在."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "正在关闭容器.."
|
||||||
|
docker-compose -f $docker_compose_file down
|
||||||
|
|
||||||
|
echo "正在更新镜像.."
|
||||||
|
docker-compose -f $docker_compose_file pull
|
||||||
|
|
||||||
|
echo "正在删除未使用的镜像..."
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
|
echo "正在启动容器.."
|
||||||
|
docker-compose -f $docker_compose_file up -d
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
update_docker_images
|
||||||
Loading…
Reference in New Issue
Block a user