Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
407 views
in Technique[技术] by (71.8m points)

docker - why am I CrashLoopBackOff

Hi I'm getting CrashLoopBackOffin my container.
Docker image is running fine in my laptop but I can run it in kubernetis

This my deployment code

apiVersion: apps/v1
kind: Deployment
metadata:
    name: react-app
    labels:
        app: jobstreet
spec:
    selector:
        matchLabels:
            app: jobstreet
            role: master
            tier: frontend
    replicas: 1

    template:
        metadata:
            labels:
                app: jobstreet
                role: master
                tier: frontend
        spec:
            containers:
                - name: master
                  image: parthi922/reactapp:v2
                  command: [ 'sh', '-c', 'echo The app is running! && sleep 3600']
                  resources:
                      requests:
                          cpu: 500m
                          memory: 500Mi
                  ports:
                      - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
    name: react-app
    labels:
        app: jobstreet
        role: master
        tier: frontend
spec:
    type: LoadBalancer
    ports:
        - port: 3000
    selector:
        app: jobstreet
        tier: frontend

When I type kubectl get logs this I what I get

standard_init_linux.go:219: exec user process caused: exec format error

enter image description here

question from:https://stackoverflow.com/questions/65853900/why-am-i-crashloopbackoff

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The error message you get probably means that the image is not prepared for a different architecture.

You can check it using the following command:

$ docker image inspect parthi922/reactapp:v2 | grep "Architecture"
        "Architecture": "arm64",

Make sure your k8 nodes are arm64 or build your image in a different architecture.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...