在Docker实战中,docker --help
命令是非常重要的一个命令,用于查看和学习Docker的各种子命令及其选项。当你运行 docker --help
时,会显示Docker的全局帮助信息,列出所有可用的顶级命令以及简短描述。
例如:
$ docker --help
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers.
Options:
-c, --config string Location of client config files (default "/Users/your_username/.docker")
-D, --debug Enable debug mode
--project-name string Project name for the current workspace
... 更多选项
Commands:
build Build an image from a Dockerfile
run Run a command in a new container
images List images
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
exec Run a command in a running container
create Create a new container
start Start one or more stopped containers
stop Stop one or more running containers
rm Remove one or more containers
rmi Remove one or more images
network Manage networks
volume Manage volumes
... 更多命令
每个命令后面都有更详细的子命令和选项,可以通过进一步执行 docker <command> --help
来获取具体命令的帮助文档。比如,要查看 docker run
的详细帮助,可以运行:
$ docker run --help
这样就可以了解如何使用 docker run
命令来创建并启动一个新的容器了。