简体   繁体   English

如何为 Oraclelinux 8 arm64v8 创建 Docker 映像

[英]How to create a Docker image for Oraclelinux 8 arm64v8

So Currently I have a Dockerfile to create "oraclelinux-8-x86" image, but I want to edit this Dockefile to create "Oraclelinux-8-arm64v8" Image instead.所以目前我有一个 Dockerfile 来创建“oraclelinux-8-x86”图像,但我想编辑这个 Dockefile 来创建“Oraclelinux-8-arm64v8”图像。

This is how my current Dockerfile looks like-这就是我当前的 Dockerfile 的样子-

FROM oraclelinux:8

# Setup basic environment stuff
ENV container docker
ENV LANG en_US.UTF-8
ENV TZ EST


# Base image stuff
#RUN yum install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel vim yum-utils sssd sssd-tools krb5-libs krb5-workstation.x86_64

# CCSMP dependent
RUN yum install -y glibc-devel.i686 krb5-devel
RUN yum install -y wget
RUN yum install -y make gcc java-1.8.0-openjdk-devel tar perl maven svn

# Minor changes to image to get ccsmp to build
RUN ln -s /usr/lib/jvm/java-1.8.0-openjdk /usr/lib/jvm/default-jvm
RUN cp /usr/include/linux/stddef.h /usr/include/stddef.h


RUN wget https://mirror.its.dal.ca/apache//ant/binaries/apache-ant-1.10.12-bin.zip
RUN unzip apache-ant-1.10.12-bin.zip && mv apache-ant-1.10.12/ /opt/ant

ENV JAVA_HOME /usr

ENV ANT_HOME="/usr/bin/ant"
ENV PATH="/usr/bin/ant:$PATH"




CMD /bin/bash

Is there any way to do this?有什么办法吗? Any suggestions are highly appreciated.任何建议都非常感谢。

The easiest way to achieve this is to use docker buildx for your builder.实现此目的的最简单方法是为您的构建器使用 docker buildx。 Buildx has a flag called --platform with which you can tell the builder what architecture you are building for. Buildx 有一个名为 --platform 的标志,您可以使用它告诉构建器您正在构建的架构。 More of this of the official docker page .官方 docker页面的更多内容。

Example:例子:

docker buildx build -t adamparco/helloworld:latest --platform linux/arm64 --push github.com/adamparco/helloworld
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t adamparco/demo:latest --push .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM