<!-- # docker-compose 命令帮助文档 --> <!-- # docker-compose-cli-help-doc --> **帮助文档:** 使用 `docker-compose --help` 命令可以查看帮助文档。 本机版本:*docker-compose version 1.29.2, build 5becea4c* , `--help` 打印结果如下: ```powershell Define and run multi-container applications with Docker. Usage: docker-compose [-f <arg>...] [--profile <name>...] [options] [--] [COMMAND] [ARGS...] docker-compose -h|--help Options: -f, --file FILE Specify an alternate compose file (default: docker-compose.yml) -p, --project-name NAME Specify an alternate project name (default: directory name) --profile NAME Specify a profile to enable -c, --context NAME Specify a context name --verbose Show more output --log-level LEVEL Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) --ansi (never|always|auto) Control when to print ANSI control characters --no-ansi Do not print ANSI control characters (DEPRECATED) -v, --version Print version and exit -H, --host HOST Daemon socket to connect to --tls Use TLS; implied by --tlsverify --tlscacert CA_PATH Trust certs signed only by this CA --tlscert CLIENT_CERT_PATH Path to TLS certificate file --tlskey TLS_KEY_PATH Path to TLS key file --tlsverify Use TLS and verify the remote --skip-hostname-check Don't check the daemon's hostname against the name specified in the client certificate --project-directory PATH Specify an alternate working directory (default: the path of the Compose file) --compatibility If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent (DEPRECATED) --env-file PATH Specify an alternate environment file Commands: build Build or rebuild services config Validate and view the Compose file create Create services down Stop and remove resources events Receive real time events from containers exec Execute a command in a running container help Get help on a command images List images kill Kill containers logs View output from containers pause Pause services port Print the public port for a port binding ps List containers pull Pull service images push Push service images restart Restart services rm Remove stopped containers run Run a one-off command scale Set number of containers for a service start Start services stop Stop services top Display the running processes unpause Unpause services up Create and start containers version Show version information and quit ``` 机翻结果如下: ```powershell 使用 Docker 定义和运行多容器应用程序。 用法: docker-compose [-f <arg>...] [--profile <name>...] [选项] [--] [指令] [参数...] docker-compose -h|--help 选项: -f, --file FILE 指定备用 compopse 文件 (默认值:docker-compose.yml) -p, --project-name NAME 指定备用项目名称 (默认:目录名) --profile NAME 指定要启用的配置文件 -c, --context NAME 指定上下文名称 --verbose 显示更多输出 --log-level LEVEL 设置日志级别(调试、信息、警告、错误、关键) --ansi (never|always|auto) 控制何时打印 ANSI 控制字符 --no-ansi 不打印 ANSI 控制字符(已弃用) -v, --version 打印版本并退出 -H, --host HOST 要连接到的守护进程套接字 --tls 使用 TLS ;由 --tlsverify 隐含 --tlscacert CA_PATH 仅由此 CA 签名的信任证书 --tlscert CLIENT_CERT_PATH TLS 证书文件的路径 --tlskey TLS_KEY_PATH TLS 密钥文件的路径 --tlsverify 使用 TLS 并验证远程 --skip-hostname-check 不要对照客户端证书中指定的名称检查守护进程的主机名 --project-directory PATH 指定备用工作目录 (默认:合成文件的路径) --compatibility 如果设置,Compose将尝试将 v3 文件中的密钥转换为其非 Swarm 等效密钥(已弃用) --env-file PATH 指定备用环境文件 指令: build 生成或重建服务 config 验证并查看 Compose 文件 create 创建服务 down 停止并删除资源 events 从容器接收实时事件 exec 在运行的容器中执行命令 help 获取命令帮助 images 镜像列表 kill 杀死容器 logs 查看容器的输出 pause 暂停服务 port 打印端口绑定的公共端口 ps 容器列表 pull 拉取服务镜像 push 推送服务镜像 restart 重新启动服务 rm 移除停止的容器 run 运行一次性命令 scale 设置服务的容器数 start 启动服务 stop 停止服务 top 显示正在运行的进程 unpause 取消暂停服务 up 创建和启动容器 version 显示版本信息并退出 ``` **常用命令:** - `docker-compose up` ::以依赖性顺序启动服务。 - `docker-compose up SERVICE_NAME` :启动指定的服务及其依赖项。 - `docker-compose up -d` :在后台启动该服务。 - `docker-compose stop SERVICE_NAME` :停止指定服务 - `docker-compose version` :显示版本信息 ```bash [root@VM-1-10-centos ~]# docker-compose version docker-compose version 1.29.1, build c34c88b2 docker-py version: 5.0.0 CPython version: 3.7.10 OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019 ``` **Links:** 1. [Docker Compose](https://www.runoob.com/docker/docker-compose.html) 2. [Overview of Docker Compose](https://docs.docker.com/compose/) 3. [Overview of docker compose CLI](https://docs.docker.com/compose/reference/) Loading... 版权声明:本文为博主「佳佳」的原创文章,遵循 CC 4.0 BY-NC-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:http://liujiajia.me/2022/8/4/docker-compose-cli-help-doc ← 上一篇 下一篇 → 提交