Difference between Docker ENTRYPOINT and Kubernetes container spec COMMAND?

Kubernetes provides us with multiple options on how to use these commands:

When you override the default Entrypoint and Cmd in Kubernetes .yaml file, these rules apply:

  • If you do not supply command or args for a Container, the defaults
    defined in the Docker image are used.
  • If you supply only args for a Container, the default Entrypoint
    defined in the Docker image is run with the args that you supplied.
  • If you supply a command for a Container, only the
    supplied command is used. The default EntryPoint and the default Cmd
    defined in the Docker image are ignored. Your command is
    run with the args supplied (or no args if none supplied).

Here is an example:

Dockerfile:

FROM alpine:latest
COPY "executable_file" /
ENTRYPOINT [ "./executable_file" ]

Kubernetes yaml file:

 spec:
    containers:
      - name: container_name
        image: image_name
        args: ["arg1", "arg2", "arg3"]

https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)