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