JDK17多架构镜像制作与Harbor推送指南
准备工作
- 确保Docker已安装(19.03+版本)
- 登录Harbor仓库:
docker login your-harbor.com
步骤
1. 拉取基础镜像
# AMD64架构
docker pull eclipse-temurin:17-jdk-jammy --platform=linux/amd64
docker tag eclipse-temurin:17-jdk-jammy your-harbor.com/library/jdk17:amd64
# ARM64架构
docker pull eclipse-temurin:17-jdk-jammy --platform=linux/arm64
docker tag eclipse-temurin:17-jdk-jammy your-harbor.com/library/jdk17:arm642. 推送单架构镜像
docker push your-harbor.com/library/jdk17:amd64
docker push your-harbor.com/library/jdk17:arm643. 创建多架构manifest
docker manifest create your-harbor.com/library/jdk17:multiarch \
your-harbor.com/library/jdk17:amd64 \
your-harbor.com/library/jdk17:arm644. 推送manifest
docker manifest push your-harbor.com/library/jdk17:multiarch5. 验证(无需实际运行)
docker manifest inspect your-harbor.com/library/jdk17:multiarch验证输出示例
成功时应该看到类似输出:
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1783,
"digest": "sha256:...",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1783,
"digest": "sha256:...",
"platform": {
"architecture": "arm64",
"os": "linux"
}
}
]
}注意事项
- 确保Harbor仓库已存在(或设置为允许自动创建)
- 推送前必须对每个架构镜像单独打tag并推送
- manifest操作不需要额外的QEMU或buildx配置
评论已关闭