有时候私有镜像库不能连接公网,我们只好通过离线的方式,从别处先拉到镜像以离线方式导入同步私有镜像库内,以下几个简单操作步骤:
1. 从开发环境将原镜像导出为 tar 文件
docker save -o nginx_stable_alpine.tar artifactory.*.cn:8082/iot-release-local/nginx:stable-alpine
2. 集成环境导入离线镜像 tar 文件
docker load -i nginx_stable_alpine.tar
3. 重命名已导入的本地镜像
docker tag artifactory.*.cn:8082/iot-release-local/nginx:stable-alpine artifactory.*.cn:8082/iot-release-local/nginx:stable-alpine
4. 删除旧镜像
docker rmi artifactory.*.cn:8082/iot-release-local/nginx:stable-alpine
5. 本地镜像推送到远程镜像库
docker rmi artifactory.*.cn:8082/iot-release-local/nginx:stable-alpine