Search code examples
dockerkubernetesdockerfilecommanddocker-entrypoint

Change entrypoint of a k8s Pod, but keep the CMD


How to change the Docker ENTRYPOINT in a Kubernetes deployment, without changing also the Docker CMD?

In the Pod I would do

image: "alpine"
entrypoint: "/myentrypoint"

but this overwrites either ENTRYPOINT and the CMD from the Dockerfile.

The documentation doesn't mention it, but seems like a big use-case missed.


Solution

  • That's not a thing.

    • ENTRYPOINT (in Dockerfile) is equal to command: (in PodSpec)
    • CMD (in Dockerfile) equals args: (in PodSpec)

    So just override command but not args.