docker 命令行 CLI详细介绍 ENTRYPOINT

docker CLI详细介绍

官方文档:https://docs.docker.com/engine/reference/run/

ENTRYPOINT (default command to execute at runtime)
The ENTRYPOINT of an image is similar to a COMMAND because it specifies what executable to run when the container starts, but it is (purposely) more difficult to override. The ENTRYPOINT gives a container its default nature or behavior, so that when you set an ENTRYPOINT you can run the container as if it were that binary, complete with default options, and you can pass in more options via the COMMAND. But, sometimes an operator may want to run something else inside the container, so you can override the default ENTRYPOINT at runtime by using a string to specify the new ENTRYPOINT. Here is an example of how to run a shell in a container that has been set up to automatically run something else (like /usr/bin/redis-server):

 docker run -it --entrypoint /bin/bash example/redis
or two examples of how to pass more parameters to that ENTRYPOINT:

 docker run -it --entrypoint /bin/bash example/redis -c ls -l
 docker run -it --entrypoint /usr/bin/redis-cli example/redis --help
You can reset a containers entrypoint by passing an empty string, for example:

 docker run -it --entrypoint="" mysql bash

Note

Passing --entrypoint will clear out any default command set on the image (i.e. any CMD instruction in the Dockerfile used to build it).

CLI

命令行界面(英语:command-line interface,缩写:CLI)是在图形用户界面得到普及之前使用最为广泛的用户界面,它通常不支持鼠标,用户通过键盘输入指令,计算机接收到指令后,予以执行。也有人称之为字符用户界面(CUI)。

猜你喜欢

转载自blog.csdn.net/qq_15821487/article/details/126156754