(Already looked all over can’t find this specific issue)
When I’m building Docker images on my Mac with Rancher Desktop set to ‘Docker (moby)’ and I’m using a generic ‘alpine’ image (latest or older) I get this error:
exec kubectl exec -i -t -n default some-pod-6d8dfb94c7-mjqml -c access-logger -- sh -c
"clear; (bash || ash || sh)"
exec /bin/sh: exec format error
(command variation doesn’t matter, sh, dash, bash, ash)
NOTE: when I use the same image ‘alpine:latest’ as-is and just use it in a pod that runs ‘sleep 999’ I CAN exec into it!
It only breaks when I build and push on my own. Here’s a sample Dockerfile, nothing special in it:
FROM golang:1.18 AS builder
WORKDIR /app
COPY . ./
RUN GOOS=linux GOARCH=amd64 go build -o my-code
FROM alpine:latest
WORKDIR /root/
COPY --from=builder /app/access-logger .
CMD ["./my-code"]
Also made sure my LANG env var is set to en_US.UTF-8