docker 重新部署脚本
工具相关的启动imgname=redis:latestcontainerName=redis6379port=6379echo stop 容器........................................docker stop $(docker ps -qf name=$containerName)echo 删除容器................................
·
工具相关的启动
imgname=redis:latest
containerName=redis6379
port=6379
echo stop 容器........................................
docker stop $(docker ps -qf name=$containerName)
echo 删除容器.....................................
docker rm $(docker ps -aqf name=$containerName)
echo 运行 镜像..................................................
docker run -d --name=$containerName -p $port:$port $imgname
自己的程序:
imgname=docker-test-1.0.jar
port=8320
echo stop 容器........................................
docker stop $(docker ps -qf name=$imgname)
echo 删除容器.....................................
docker rm $(docker ps -aqf name=$imgname)
echo 删除镜像.............................................
docker images|grep $imgname |awk '{print $3}'|xargs docker rmi
echo 生成镜像...................................................
docker build -t $imgname .
echo 运行 镜像..................................................
docker run -d --name=$imgname -p $port:$port -v ~/opt/logs/$imgname:/root/opt/logs $imgname
更多推荐
已为社区贡献1条内容
所有评论(0)