k8s打镜像-压缩镜像-解压镜像

habor操作镜像:

docker images
docker tag account-service-image-20210830:latest   harbor-image.yyyyy.me/refactorboss-snapshot/account-service:20210830
docker login -u admin -p harbor12345 harbor-image.yyyyy.me
docker push harbor-image.yyyyy.me/refactorboss-snapshot/account-service:20210830
docker push harbor-image.yyyyy.me/refactorboss-snapshot/account-service:20210830
docker login harbor-image.yyyyy.me
docker push harbor-image.yyyyy.me/refactorboss-snapshot/account-service:20210830

手动传输镜像:

在10.0.222.108上/data/harbor/harbor-data/registry/docker/registry/v2/repositories/stariboss/buildimage/目录下制作,其他服务器有可能没权限下载10.0.222.108的基础镜像

该目录上传好area-service.jar

编辑Dockerfile:

[[email protected] /data/harbor/harbor-data/registry/docker/registry/v2/repositories/stariboss/buildimage]#vi Dockerfile

FROM 10.0.222.108/library/centos-openjdk-11:centos7.2.1511-200604

ADD ./area-service.jar /opt/service/area-service.jar

ENTRYPOINT ["java", "-jar", "/opt/service/area-service.jar"]

执行构建:

[[email protected] /data/harbor/harbor-data/registry/docker/registry/v2/repositories/stariboss/buildimage]#docker build -t area-service-image-20210714 .

查看镜像:

[[email protected] /data/harbor/harbor-data/registry/docker/registry/v2/repositories/stariboss/buildimage]#docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

area-service-image-20210714 latest 384879533037 50 seconds ago 782MB

压缩镜像:

[[email protected] /data/harbor/harbor-data/registry/docker/registry/v2/repositories/stariboss/buildimage]#docker save area-service-image-2021071:latest > area-service.tar

把area-service.tar发给现场再解压缩出镜像并部署

你可能感兴趣的:(常用工具,docker,java)