1

I tried to create a kubernetes deployment to EKS but I encounter this error

Containers:
  locust-master:
    Container ID:   docker://abc3a719222289774988bad3b1b1cfcc04c5b37559038aed49d3d00827fcc94c
    Image:          mosesliao/locust:1.3.2
    Image ID:       docker-pullable://mosesliao/locust@sha256:74368de2e5cf9e9a679bdb2c371a47cc2aea813e5a697f2282a6b593f179088f
    Ports:          5557/TCP, 5558/TCP, 8089/TCP
    Host Ports:     0/TCP, 0/TCP, 0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       ContainerCannotRun
      Message:      OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"/docker-entrypoint.sh\": permission denied": unknown
      Exit Code:    126
      Started:      Tue, 10 Nov 2020 21:33:39 +0800
      Finished:     Tue, 10 Nov 2020 21:33:39 +0800
    Ready:          False
    Restart Count:  2
    Environment:
      LOCUST_MODE:  MASTER
      LOCUST_OPTS:  --print-stats
    Mounts:
      /locust from locust-scripts (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5v8d6 (ro)

What could be the issue? this is my dockerfile for locust

FROM locustio/locust

COPY docker-entrypoint.sh /

USER root

RUN chmod +x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
Moses Liao GZ
  • 1,556
  • 5
  • 20
  • 45
  • Could you please go to your machine where you are building the docker image and execute: `ls -la path/to/docker-entrypoint.sh`? What is the first column of the output for the script file? – Wytrzymały Wiktor Nov 12 '20 at 09:49

1 Answers1

0

There are few possible solutions here that I will try to list:

  1. The docker-entrypoint.sh should be in the same folder as the Dockerfile. You need to adjust the COPY path, for example:

COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"] 
  1. Permissions set through the Dockerfile might not always be applied properly. You should make your host's docker-entrypoint.sh executable. To do so, run: ls -la path/to/docker-entrypoint.sh, check if the first column of the output for your executable has executable bits set to something like: -rwxrwxr-x and if not than run: chmod +x docker-entrypoint.sh.

  2. Try using


ENTRYPOINT ["sh", "/docker-entrypoint.sh"]

without using chmod as it doesn't need the executable permission.

Remember to rebuild and rerun after making the changes.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37