docker compose pull
描述 | 拉取服務映象 |
---|---|
用法 | docker compose pull [OPTIONS] [SERVICE...] |
描述
拉取 compose.yaml
檔案中定義的服務相關聯的映象,但不會基於這些映象啟動容器。
選項
選項 | 預設值 | 描述 |
---|---|---|
--ignore-buildable | 忽略可構建的映象 | |
--ignore-pull-failures | 拉取能拉取的映象,並忽略拉取失敗的映象 | |
--include-deps | 同時拉取宣告為依賴的服務 | |
--policy | 應用拉取策略("missing"|"always") | |
-q, --quiet | 不列印進度資訊進行拉取 |
示例
考慮以下 compose.yaml
services:
db:
image: postgres
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/myapp
ports:
- "3000:3000"
depends_on:
- db
如果您在定義服務的 compose.yaml
檔案所在的同一目錄下執行 docker compose pull ServiceName
,Docker 將拉取相關的映象。例如,要呼叫我們示例中配置為 db 服務的 postgres 映象,您可以執行 docker compose pull db
。
$ docker compose pull db
[+] Running 1/15
⠸ db Pulling 12.4s
⠿ 45b42c59be33 Already exists 0.0s
⠹ 40adec129f1a Downloading 3.374MB/4.178MB 9.3s
⠹ b4c431d00c78 Download complete 9.3s
⠹ 2696974e2815 Download complete 9.3s
⠹ 564b77596399 Downloading 5.622MB/7.965MB 9.3s
⠹ 5044045cf6f2 Downloading 216.7kB/391.1kB 9.3s
⠹ d736e67e6ac3 Waiting 9.3s
⠹ 390c1c9a5ae4 Waiting 9.3s
⠹ c0e62f172284 Waiting 9.3s
⠹ ebcdc659c5bf Waiting 9.3s
⠹ 29be22cb3acc Waiting 9.3s
⠹ f63c47038e66 Waiting 9.3s
⠹ 77a0c198cde5 Waiting 9.3s
⠹ c8752d5b785c Waiting 9.3s
docker compose pull
會嘗試為包含構建部分的服務拉取映象。如果拉取失敗,它會告知您此服務映象必須構建。您可以透過設定 --ignore-buildable
標誌來跳過此操作。