首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

docker-compose pull

代码语言:javascript
复制
Usage: pull [options] [SERVICE...]

Options:
    --ignore-pull-failures  Pull what it can and ignores images with pull failures.
    --parallel              Pull multiple images in parallel.
    --quiet                 Pull without printing progress information

提取与在docker-compose.ymldocker-stack.yml文件中定义的服务相关联的映像,但不会基于这些映像启动容器。

例如,假设您docker-compose.yml从 Quickstart:Compose 和 Rails 示例中获得此文件。

代码语言:javascript
复制
version: '2'
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

如果你docker-compose pull ServiceNamedocker-compose.yml定义服务的文件所在的目录下运行,Docker 会提取 postgres 镜像。例如,要在我们的示例中调用postgres配置为db服务的映像,您可以运行docker-compose pull db

代码语言:javascript
复制
$ docker-compose pull db
Pulling db (postgres:latest)...
latest: Pulling from library/postgres
cd0a524342ef: Pull complete
9c784d04dcb0: Pull complete
d99dddf7e662: Pull complete
e5bff71e3ce6: Pull complete
cb3e0a865488: Pull complete
31295d654cd5: Pull complete
fc930a4e09f5: Pull complete
8650cce8ef01: Pull complete
61949acd8e52: Pull complete
527a203588c0: Pull complete
26dec14ac775: Pull complete
0efc0ed5a9e5: Pull complete
40cd26695b38: Pull complete
Digest: sha256:fd6c0e2a9d053bebb294bb13765b3e01be7817bf77b01d58c2377ff27a4a46dc
Status: Downloaded newer image for postgres:latest

扫码关注腾讯云开发者

领取腾讯云代金券