在线文档教程
Docker 17
撰写 | Compose

docker-compose up

docker-compose up

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

如果使用SIGINTctrl+ C)中断进程或者SIGTERM容器停止,并且退出代码为0

如果SIGINTSIGTERM在此关闭阶段再次发送,正在运行的容器将被终止,并且退出代码为2

fig, composition, compose, docker, orchestration, cli, up