#停止容器运行和删除对应镜像方法 stop(){ #定义容器和镜像的名称 imagesName=vci-ubcs/ubcs- #定义服务名称 containerName=ubcs-auth #如果存在,就关闭并且删除该容器 if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-admin containerName=ubcs-admin if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-auth containerName=ubcs-auth if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-log containerName=ubcs-log if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-desk containerName=ubcs-desk if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-flow containerName=ubcs-flow if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-develop containerName=ubcs-develop if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-jobadmin containerName=ubcs-jobadmin if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-job containerName=ubcs-job if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-report containerName=ubcs-report if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-resource containerName=ubcs-resource if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-swagger containerName=ubcs-swagger if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-system containerName=ubcs-system if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-user containerName=ubcs-user if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-gateway containerName=ubcs-gateway if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-omd containerName=ubcs-omd if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-code containerName=ubcs-code if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi imagesName=vci-ubcs/ubcs-applyjtcodeservice containerName=ubcs-applyjtcodeservice if [[ -n $(docker ps -q -f "name=$containerName") ]];then echo $containerName" is up,we will stop and remove it !!!" docker stop $containerName docker rm $containerName docker rmi $imagesName else echo $containerName" is not up!!!" fi #其他服务需要,请自行添加 } stop