Difference between Docker ENTRYPOINT and Kubernetes container spec COMMAND?

后端 未结 3 709
执笔经年
执笔经年 2020-12-23 15:52

Dockerfile has a parameter for ENTRYPOINT and while writing Kubernetes deployment YAML file, there is a parameter in Container spec for COMMAND.

I

3条回答
  •  青春惊慌失措
    2020-12-23 16:59

    The key difference is terminology. Kubernetes thought that the terms that Docker used to define the interface to a container were awkward, and so they used different, overlapping terms. Since the vast majority of containers Kubernetes orchestrates are Docker, confusion abounds.

    Specifically, docker entrypoints are kubernetes commands, and docker commands are kubernetes args, as indicated here: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes.

    -------------------------------------------------------------------------------------
    | Description                           | Docker field name | Kubernetes field name |
    -------------------------------------------------------------------------------------
    | The command run by the container      | Entrypoint        | command               |
    | The arguments passed to the command   | Cmd               | args                  |
    -------------------------------------------------------------------------------------
    

    @Berk's description of how Kubernetes uses those runtime options is correct, but it's also correct for how docker run uses them, as long as you translate the terms. The key is to understand the interplay between image and run specifications in either system, and to translate terms whenever speaking of the other.

提交回复
热议问题