简体   繁体   中英

How to override Dockerfile's entrypoint `/bin/sh` from kubernetes job's deployment yml?

I have an entrypoint defines as ENTRYPOINT ["/bin/sh"] in Dockerfile . The docker image contains most of the shell scripts. But later on I added a Golan scripts, which I want to run from kubernetes job. But due to entrypoint defined as /bin/sh , it gives me error No such file or directory when I try to run the compiled and installed go binary through args in yml of kubernetes job's deployment descriptor.

Any well defined way to achieve such goal?

As standing in documentation you can override docker's entrypoint by using command section of pod's definition in deployment.yaml, example from docs:

apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
  - name: command-demo-container
    image: debian
    command: ["printenv"]
    args: ["HOSTNAME", "KUBERNETES_PORT"]
  restartPolicy: OnFailure

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM