# FROM arm64v8/ubuntu:20.04
# or use a base image suitable for both ARM64 and AMD64 architectures
FROM --platform=linux/amd64,linux/arm64 ubuntu:20.04
RUN apt-get update && apt-get install -y openjdk-11-jre
# Copy your Java application JAR or files
COPY your-app.jar /app.jar
CMD ["java", "-jar", "/app.jar"]
docker buildx install
docker buildx build --push --platform linux/amd64,linux/arm64 -t your-image-name:tag .
docker run -d your-image-name:tag # please test on both amd64 and arm64
1条答案
按热度按时间3qpi33ja1#
正如评论中提到的,如果你不能改变PC(从arm 64到amd 64),你可以用这个来创建你的docker镜像:
Docker镜像示例:
参考号:https://docs.docker.com/build/building/multi-platform/
**参考号:**https:docs.docker.com/build/building/multi-platform/#cross-compilation
你应该在arm 64设备上构建。在上面的参考(交叉编译)中,您可以列出Arm 64上的构建器:
请详细阅读交叉编译参考。