©
本文档使用
php.cn手册 发布
Usage: up [options] [--scale SERVICE=NUM...] [SERVICE...] Options: -d Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit. --no-color Produce monochrome output. --no-deps Don't start linked services. --force-recreate Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate. --no-recreate If containers already exist, don't recreate them. Incompatible with --force-recreate. --no-build Don't build an image, even if it's missing. --build Build images before starting containers. --abort-on-container-exit Stops all containers if any container was stopped. Incompatible with -d. -t, --timeout TIMEOUT Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10) --remove-orphans Remove containers for services not defined in the Compose file --exit-code-from SERVICE Return the exit code of the selected service container. Implies --abort-on-container-exit. --scale SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.
构建,(重新)创建,启动并附加到服务的容器。
除非它们已经在运行,否则该命令还会启动任何链接的服务。
该docker-compose up
命令汇总每个容器的输出。当命令退出时,所有容器都停止。运行docker-compose up -d
将在后台启动容器并使其运行。
如果存在服务的现有容器,并且在创建容器后服务的配置或映像已更改,则docker-compose up
通过停止并重新创建容器(保留已安装的卷)来提取更改。要防止撰写选取更改,请使用该--no-recreate
标志。
如果您想强制 Compose 停止并重新创建所有容器,请使用该--force-recreate
标志。
如果进程遇到错误,则此命令的退出代码为1
。
如果使用SIGINT
(ctrl
+ C
)中断进程或者SIGTERM
容器停止,并且退出代码为0
。
如果SIGINT
或SIGTERM
在此关闭阶段再次发送,正在运行的容器将被终止,并且退出代码为2
。