docker 镜像创建 发表于 2023-02-14 更新于 2023-02-15 分类于 05 笔记 , 52 开发工具 阅读次数: docker镜像生成dockerfile12345678910# Dockerfile 文件FROM openjdk:8u342-jdkCOPY /*.jar /app.jarCMD ["--server.port=8080"]EXPOSE 8080ENTRYPOINT ["java","-jar","/app.jar"] docker compose将容器转成镜像1234567891011121314# 生成镜像docker commit nginx-chinese-color foxhello.com/nginx/chinese-colors:1.0.0# 保存镜像docker save -o chinacolor.tar foxhello.com/nginx/chinese-colors:1.0.0# 加载镜像docker load --input chinacolor.tar # 运行程序docker run --name chinacolor -p 9966:80 -d foxhello.com/nginx/chinese-colors:1.0.0# 访问网址http://127.0.0.1:9966 将镜像上云1234567891011121314151617181920docker loginfmzh# 重命名镜像docker tag foxhello.com/nginx/chinese-colors:1.0.0 fmzh/chinacolor # 在官网创建路径https://hub.docker.com/repositories/fmzh# 上传镜像docker push fmzh/chinacolor# 下载镜像docker pull fmzh/chinacolor:latest# 运行docker run --name chinacolor -p 9966:80 -d fmzh/chinacolor# 访问网址http://127.0.0.1:9966 将镜像上nexus123456789101112# nexus docker上传要求https 且是8082端口docker login https://nexus.foxhello.com -u admin -p fmzh201# 重命名镜像docker tag fmzh/chinacolor nexus-docker.foxhello.com/nginx/chinese-colors:1.0.0 # 上传镜像docker push nexus-docker.foxhello.com/nginx/chinese-colors:1.0.0 # 下载镜像docker login https://nexus-docker.foxhello.comdocker pull nexus-docker.foxhello.com/nginx/chinese-colors:1.0.0 参考 容器打包成镜像 镜像上云 Dockerfile 示例 docker 上 nexus 打赏 微信支付 支付宝