Home > database >  Issue - Building Docker Image - as linux/amd64 on Macbook M1 Chip
Issue - Building Docker Image - as linux/amd64 on Macbook M1 Chip

Time:09-27

I am trying to build the following image out of a Dockerfile.

Dockerfile source# https://github.com/AykutSarac/jsoncrack.com/blob/main/Dockerfile

Docker host machine spec: Macbook Pro M1 chip

I checked the following post: standard_init_linux.go:178: exec user process caused "exec format error"

I added on the top extra lines:

#!/bin/bash
# Build for AMD64
# Builder
FROM node:14-buster as builder
WORKDIR /src
COPY . /src
RUN yarn install --legacy-peer-deps
RUN yarn run build

# App
FROM nginxinc/nginx-unprivileged
COPY --from=builder /src/out /app
COPY default.conf /etc/nginx/conf.d/default.conf

And then I created the image using the following commmand:

docker build -t username/jsoncrack-1-amd64 . --no-cache=true --platform=linux/amd64 

Still showing the image when is pushed as arm type not

Any ideas on how to get that image built as Linux/AMD64 out of that Dockerfile?

Note: I am able to create other docker images on the M1 Apple Macbook without issues, the issue is only with this dockerfile.

Thanks

CodePudding user response:

Actually I had to delete older images that would match the image build which end up pushing the older version ARM, not AMD.

Everything is working as expected with the steps above (Just make sure to clean your local stored images)

  • Related