加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
docker.sh 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
fangang 提交于 2021-05-08 14:47 . The first commit.
# !bin/bash
container_name=$1
image_name=$1
container_temp=$(docker ps | grep ${container_name}|awk '{print $1}')
if [ ${#container_temp} != 0 ] ; then
echo "living container is existing"
docker rm -f ${container_temp}
if [ $? == 0 ] ; then
echo "---------------------------------"
echo "container remove success!!"
echo "---------------------------------"
fi
else
echo "---------------------------------"
echo "no container is living!"
echo "---------------------------------"
fi
image_temp=$(docker images | grep ${image_name} | awk '{print $3}')
if [ ${#image_temp} != 0 ] ; then
echo "-----------------------------------"
echo "image is existing!!"
echo "-----------------------------------"
docker rmi -f ${image_temp}
if [ $? == 0 ] ; then
echo "---------------------------------"
echo "image remove success!!"
echo "---------------------------------"
fi
else
echo "----------------------------------"
echo "no image is exist!"
echo "----------------------------------"
fi
echo "-------------------------------------"
echo "waiting ---------------------"
echo "-------------------------------------"
sleep 10
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化