I have a query, I build docker image locally ran it working fine. I pushed it to ECR repo. Then I try running using kubernetes it is giving CrashLoopBackOff with Terminated and exit code 1
did you check kubectl describe command
Yes it is giving State: Waiting
Last State: Terminated
Exit Code: 1
What do you mean by it’s running fine on local?
I created docker image for tomcat and did docker run it is working fine. Then I pushed the image to ECR and then on EKS I wrote Deployment.yaml where it is giving above error. When I did kubectl describe pod
Do you see the messages about pulling the docker image from ECR repository?
Please paste full message.
Type Reason Age From Message
Normal Scheduled 6m24s default-scheduler Successfully assigned default/tomcat-deployment-745f657dd4-ng6tg to ip-10-0-1-154.ap-south-1.compute.internal
Normal Pulled 6m10s kubelet Successfully pulled image “public.ecr.aws/i6b6v3j1/tomcat-repo:latest” in 13.520106681s
Normal Pulled 6m6s kubelet Successfully pulled image “public.ecr.aws/i6b6v3j1/tomcat-repo:latest” in 2.283368647s
Normal Pulled 5m47s kubelet Successfully pulled image “public.ecr.aws/i6b6v3j1/tomcat-repo:latest” in 2.285123405s
Normal Created 5m16s (x4 over 6m9s) kubelet Created container tomcat
Normal Started 5m16s (x4 over 6m9s) kubelet Started container tomcat
Normal Pulled 5m16s kubelet Successfully pulled image “public.ecr.aws/i6b6v3j1/tomcat-repo:latest” in 2.297448812s
Normal Pulling 4m35s (x5 over 6m23s) kubelet Pulling image “public.ecr.aws/i6b6v3j1/tomcat-repo:latest”
Warning BackOff 82s (x24 over 6m5s) kubelet Back-off restarting failed container
In logs it is giving
standard_init_linux.go:228: exec user process caused: exec format error
Hi @Ashutosh Pathak
Before working on k8s, could you please try this docker commands & share the output.
##cleanup stopped container permenantly:
docker ps -a
docker rm <container-name>
docker ps -a
###Remove an Image, which is already downloaded from Docker Hub:
docker rmi tomcat-repo:latest
##Only pull an Image & not to create a container:
docker pull tomcat-repo:latest
I removed container and image
then pulled the image it is giving output
latest: Pulling from i6b6v3j1/tomcat-repo
Status: Downloaded newer image for public.ecr.aws/i6b6v3j1/tomcat-repo:latest
I am able to run this docker image after pull
but same is creating problem when I tried it from K8s Deployment yaml
it’s a public image can anyone try this
Its because of diff OS architecture, maybe you built the image on diff OS architecture, that’s the reason, try to build the image for amd64, arm, etc… if you built the image on Raspberry pi then you wanna run it on amd64, it’s not possible
standard_init_linux.go:228: exec user process caused: exec format error.
The log above shows very well that the image is built on diff OS arch
ok should I use buildx of docker to have diff target envt.