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

7/15/2019

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?

-- hemu
docker
kubernetes

1 Answer

7/15/2019

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
-- Jakub Bujny
Source: StackOverflow