Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker CMD (command) and ARGS (parameter) use collation

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Docker CMD (command) and ARGS (parameter) are used to organize the overview

When a K8S cluster creates a Pod, you can set the command and its parameters to be executed at startup for the container under it. To set the command, enter it under the command field of the configuration file. If you want to set the parameters of the command, enter it under the args field of the configuration file. Once the Pod is created, the command and its input parameters can no longer be changed.

If the configuration file sets the commands and parameters to be executed when the container starts, the commands and parameters included in the container image will be overwritten and will no longer be executed. If only the input parameter is set in the configuration file, but not its corresponding command, the command included in the container image will use the new parameter as its execution parameter.

The corresponding field name in Docker and Kubernetes. Describe the Docker field name Kubernetes field name container run commands Entrypointcommand passed to the command parameter set Cmdargs rules

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

If command or args is not set in the container configuration, the command that comes with the Docker image and its input parameters are used.

If only command but not args is set in the container configuration, the command will only be executed when the container starts, and the commands and their input parameters in the Docker image will be ignored.

If only args is set in the container configuration, the commands included in the Docker image use this new input parameter as the input parameter for its execution.

If both command and args are set in the container configuration, the commands and their input parameters in the Docker image will be ignored. When the container starts, it only executes the commands set in the configuration and uses the input parameters set in the configuration as the input parameters of the command.

Reference answer:

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report