Docker Error when pushing image with CIRCLE CI. platform arm/64 host amd/64

Hello I have an ARM server, so I need to compile the image I have to ARM, but I have this error:

—> [Warning] The requested image’s platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested
—> Running in a27002134666
standard_init_linux.go:228: exec user process caused: exec format error

This is my code (DOCKERFILE):

FROM --platform=arm64 node:14.5.0-alpine

set working directory

RUN mkdir /usr/src/app

WORKDIR /usr/src/app

add /usr/src/app/node_modules/.bin to $PATH

ENV PATH /usr/src/app/node_modules/.bin:$PATH

install and cache app dependencies

COPY package.json /usr/src/app/package.json

RUN npm install

RUN npm install -g @angular/cli@11.0.3

add app

COPY . /usr/src/app

#generate build

RUN npm run build

base image

FROM --platform=arm64 nginx:latest

copy artifact build from the ‘build environment’

COPY --from=builder /usr/src/app/dist/fronted /usr/share/nginx/html

COPY default.conf /etc/nginx/conf.d/default.conf

expose port 80


run nginx

CMD [“nginx”, “-g”, “daemon off;”]

The processor environment is going to be set by the configuration you have defined within config.yml and so you need to check that you have this correctly defined for a Linux/arm64 target.

If you need more feedback you will need to post your config.yml file.

You need to use a machine runner, not a docker one in your yaml. And resource_class must be arm (like arm.medium). Example:

    resource_class: arm.medium
      image: ubuntu-2004:current

      - checkout
      - run:
          name: "Build"
          command: |
            echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USER" --password-stdin
            docker build (...)
            docker push (...)
      - run:
          name: "Docker Logout"
          when: always
          command: docker logout