#!/bin/bash # 命名镜像 local_imge="search-image:v1.0.0" repository_image="registry.cn-chengdu.aliyuncs.com/infish/search-image:v1.0.0" # 删除本地已存在的镜像 docker rmi $repository_image # 创建本地镜像 docker build -t $local_imge . # 镜像标签 docker tag $local_imge $repository_image # push到镜像仓库,需要登陆对应docker仓库账号 # docker push $repository_image # docker commit container image