本文主要是介绍撤回虚拟机前撤回容器,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#!/bin/bash#descrition: #虚拟机销毁前删除容器 #The log output file:/var/log/docker_delete_debug.log ##$1:$LINENO #$2:ERROR/DEBUG/INFO #$3:MSG log(){Time=`date "+%Y-%m-%d %H:%M:%S"`#currentTimeStamp=`date +%s`echo "$Time sh:docker-env-init.sh lineNo:$1 $2::$3" >> /var/log/docker_delete_debug.log }main() {true > /var/log/docker_delete_debug.loglog "$LINENO" "DEBUG" "shell-start."#删除所有容器(label=namespace=app)log "$LINENO" "info" "Delete all contain the namespace=app container start."docker rm -f `docker ps -a -q --filter "label=namespace=app"`log "$LINENO" "info" "Delete all contain the namespace=app container done."log "$LINENO" "DEBUG" "shell-finished."} java -jar /etc/sensu/plugins/appRegister.jar 172.16.80.85:8090 delete main
这篇关于撤回虚拟机前撤回容器的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!