Issue
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.
This is how my current Dockerfile looks like-
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.
Solution
The easiest way to achieve this is to use docker buildx for your builder. Buildx has a flag called --platform with which you can tell the builder what architecture you are building for. More of this of the official docker page.
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 .
Answered By - matic1123
Answer Checked By - Katrina (JavaFixing Volunteer)