码头工人组成
预计阅读时间:2分钟
Usage: up [options] [--scale SERVICE=NUM...] [SERVICE...]
Options:
-d, --detach Detached mode: Run containers in the background,
print new container names. Incompatible with
--abort-on-container-exit.
--no-color Produce monochrome output.
--quiet-pull Pull without printing progress information
--no-deps Don't start linked services.
--force-recreate Recreate containers even if their configuration
and image haven't changed.
--always-recreate-deps Recreate dependent containers.
Incompatible with --no-recreate.
--no-recreate If containers already exist, don't recreate
them. Incompatible with --force-recreate and
--renew-anon-volumes.
--no-build Don't build an image, even if it's missing.
--no-start Don't start the services after creating them.
--build Build images before starting containers.
--abort-on-container-exit Stops all containers if any container was
stopped. Incompatible with --detach.
--attach-dependencies Attach to dependent containers.
-t, --timeout TIMEOUT Use this timeout in seconds for container
shutdown when attached or when containers are
already running. (default: 10)
-V, --renew-anon-volumes Recreate anonymous volumes instead of retrieving
data from the previous containers.
--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 logs --follow
)。当命令退出时,所有容器都将停止。运行docker-compose up --detach
将在后台启动容器并使它们保持运行状态。
如果已有用于服务的容器,并且在创建容器后更改了服务的配置或映像,请docker-compose up
通过停止并重新创建容器(保留装入的卷)来获取更改。为防止Compose获取更改,请使用该--no-recreate
标志。
如果要强制Compose停止并重新创建所有容器,请使用该
--force-recreate
标志。
如果进程遇到错误,则此命令的退出代码为1
。
如果使用SIGINT
(ctrl
+ C
)或中断该过程SIGTERM
,则容器将停止,并且退出代码为0
。
如果在此关闭阶段再次发送SIGINT
或,SIGTERM
则会终止正在运行的容器,并且退出代码为2
。