Derived jenkins docker image fails during init phase on helm install with `exec /usr/bin/sh: exec format error`
hectoralicea opened this issue · 3 comments
Jenkins and plugins versions report
Environment
Paste the output here
What Operating System are you using (both controller, and any agents involved in the problem)?
Running in Amazon Linux in an EKS cluster
based (FROM) derived docker image from: docker.io/jenkins/jenkins:2.375.2-rhel-ubi8-jdk11
Reproduction steps
- ) Build the a derived docker image using the following docker source, named: XXXXXXXXXXX.dkr.ecr.us-gov-west-1.amazonaws.com/das/gw/jenkins/jenkins
FROM docker.io/jenkins/jenkins:2.375.2-rhel-ubi8-jdk11
ARG user=jenkins
USER root
# make custom changes to jenkins container for this customer
RUN dnf update -y && \
dnf -y -q install ca-certificates jq bind-utils nmap && \
rm -rf /var/cache /var/log/dnf* /var/log/yum.* && \
dnf clean all -y
COPY --chown=${user}:${user} daas-sandbox-root-ca.crt /etc/pki/ca-trust/source/anchors/daas-sandbox-root-ca.crt
RUN chmod 644 /etc/pki/ca-trust/source/anchors/daas-sandbox-root-ca.crt && \
cat /etc/pki/ca-trust/source/anchors/daas-sandbox-root-ca.crt && \
echo run update-ca-trust && \
update-ca-trust && \
echo ran update-ca-trust
USER ${user}
# as specified in the jenkins Docker file,
# from a derived Dockerfile, can use `RUN install-plugins.sh active.txt` to setup $REF/plugins from a support bundle
RUN install-plugins.sh active.txt
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/jenkins.sh"]
2.) create a values.yaml file to feed to the helm deploy which has the following settings
controller:
image: "XXXXXXXXXXX.dkr.ecr.us-gov-west-1.amazonaws.com/das/gw/jenkins/jenkins"
tag: "2.375.2-rhel-ubi8-jdk11"
run a helm install
Jenkins should startup without issue.
Expected Results
Jenkins should startup without issue. Init container should install all the plugins, then the jenkins pod should boot strap and start the jenkins app.
Actual Results
It fails at container init. The following error shows in the log
hector$ kc logs -n cicd jenkins-0 -c init
exec /usr/bin/sh: exec format error
hector$ kc get pods -n cicd
NAME READY STATUS RESTARTS AGE
jenkins-0 0/2 Init:CrashLoopBackOff 46 (2m47s ago) 3h34m
The events from this command is
kc describe pod -n cicd jenkins-0
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulling 34m (x41 over 3h34m) kubelet Pulling image "XXXXXXXXXXX.dkr.ecr.us-gov-west-1.amazonaws.com/das/gw/jenkins/jenkins:2.375.2-rhel-ubi8-jdk11"
Warning BackOff 4m11s (x969 over 3h34m) kubelet Back-off restarting failed container
Anything else?
What am I doing wrong in my derived Dockerfile?
Hi @hectoralicea , what is the kind of CPU used for the nodes in your Kubernetes cluster?
The errors sounds like an Intel (linux/amd64
) Docker image executed on an ARM (linux/arm64
) machine (but I could be wrong).
yea, I just realized this. I'm building this on a M1 MacBook, and but running on an EKS cluster inside an Amazon Linux which I presume is x86-64. Need to find the docker build parameter which instructs to build an linux/x86-64 architecture.
yea, I just realized this. I'm building this on a M1 MacBook, and but running on an EKS cluster inside an Amazon Linux which I presume is x86-64. Need to find the docker build parameter which instructs to build an linux/x86-64 architecture.
docker build --platform=linux/amd64 <...>
is your friend as per https://docs.docker.com/engine/reference/commandline/build/ 🤗
Be warned that it might be slower on your machine (because QEMU or Rosetta will take care of emulating the amd64
platform): be patient 😅
I'm closing the issue as it's not a problem with the Jenkins Docker image.