Docker CMD (command) and ARGS (parameters) using finishing

Docker CMD (command) and ARGS (parameters) using finishing

Overview

K8S cluster When you create a Pod, its command and its parameters can be set in the container start to be executed. Set command, fill in the command field of the configuration file, if you want to set the parameters of the command, just fill in the args field profile. Pod Once created, the command and the reference can not change it.

Configuration file set up command and its parameters start to be executed when the container, the container mirror with built-in command parameters will be overwritten and no longer perform. If the configuration file, the only parameters provided, but no corresponding command set, the container carrying the mirror command the new parameter as a parameter used when its execution.

Docker field names corresponding Kubernetes.

description Docker field name Kubernetes field name
Run the command vessel Entrypoint command
A set of parameters passed to the command Cmd args

rule

If you want to override the default Entrypoint and Cmd, need to follow the following rules:

If no command or args in the container configuration, will be used Docker image into its own command parameters.

If the container configuration set up only command but do not set args, then the container will execute the command start, Docker image that comes into the command and its participants are ignored.

If only the configuration in the container is provided args, then Docker mirror command comes to use the new parameters into the parameter as at its execution.

If the container is provided both configuration command and args, then comes Docker mirror command is ignored and the participants. Run configuration will set the container starts, as a command using the parameters of the parameter set in the configuration.

Answer:

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

Guess you like

Origin blog.51cto.com/michaelkang/2449082