?
This document uses PHP Chinese website manual Release
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.
構(gòu)建,(重新)創(chuàng)建,啟動并附加到服務(wù)的容器。
除非它們已經(jīng)在運行,否則該命令還會啟動任何鏈接的服務(wù)。
該docker-compose up
命令匯總每個容器的輸出。當(dāng)命令退出時,所有容器都停止。運行docker-compose up -d
將在后臺啟動容器并使其運行。
如果存在服務(wù)的現(xiàn)有容器,并且在創(chuàng)建容器后服務(wù)的配置或映像已更改,則docker-compose up
通過停止并重新創(chuàng)建容器(保留已安裝的卷)來提取更改。要防止撰寫選取更改,請使用該--no-recreate
標(biāo)志。
如果您想強制 Compose 停止并重新創(chuàng)建所有容器,請使用該--force-recreate
標(biāo)志。
如果進程遇到錯誤,則此命令的退出代碼為1
。
如果使用SIGINT
(ctrl
+ C
)中斷進程或者SIGTERM
容器停止,并且退出代碼為0
。
如果SIGINT
或SIGTERM
在此關(guān)閉階段再次發(fā)送,正在運行的容器將被終止,并且退出代碼為2
。