skip to Main Content

hi following are my docker file commands

ARG debianVersion=10.2
FROM debian:${debianVersion}
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
ARG AGENT_WORKDIR=/home/${user}/agent
USER root
RUN apt-get update
RUN groupadd -g ${gid} ${group}
RUN useradd -c "Jenkins user" -d /home/${user} -u ${uid} -g ${gid} -m ${user}

I am using rancher desktop on mac m1 chip.

On executing following command I a getting error

docker build -t test --platform linux/x86_64 .

Error message is as follows

[Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
---> Running in 7778b2303192
-c: 0: Can't open apt-get update
The command '/bin/sh -c apt-get update' returned a non-zero code: 127

Found that none of the shell commands are working getting error a non-zero code: 127 how to fix this?

Using rancher version 1.5.0
Using container runtime dockerd(moby)
Using Kubernetes version v1.21.14

3

Answers


  1. Dockerfile:

    …
    FROM --platform=linux/arm64 debian:${debianVersion}
    …
    

    Build command:

    docker build -t test --platform linux/arm64 .
    
    Login or Signup to reply.
  2. Downgrade to Rancher Desktop 1.4.1.

    This works but if downgrading is not an option there are workarounds on the Rancher Desktop Issues site for similar problems like this:
    qemu workaround

    As a temporary workaround, as root in the VM:

    Create /etc/conf.d/qemu-binfmt, with contents binfmt_flags="POCF"
    Run rc-update --update
    Run rc-service qemu-binfmt restart
    

    Easy way to connect to the VM and run those commands is (source):

    docker run -it --rm --privileged --pid=host justincormack/nsenter1
    
    Login or Signup to reply.
  3. As far as I understand it dockerd runtime can only emulate other platform types (in the above case --platform=linux/amd64) on the m1 chip macs using Docker Desktop.

    Try using the built in nerdctl that comes packaged with Rancher Desktop:

    nerdctl build -t test --platform linux/amd64 .
    nerdctl build -t test --platform linux/x86_64 .
    

    N.B. I have found that even with emulation, some --platform linux/x86_64 (linux/amd64) images still cannot be built, recently experienced that with official selenium set, but had no problem with wso2 & mailcatcher images

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search