描述
下载服务相关镜像,docker-compose.yml 或 docker-stack.yml 文件中定义的镜像。
用法
Usage: pull [options] [SERVICE...] Options: --ignore-pull-failures 忽略下载失败的镜像. --parallel 废除, 并行下载多镜像,默认并行. --no-parallel 禁止并行下载. -q, --quiet 静默下载,不打印信息 --include-deps 下载依赖
实例
docker-compose.yml
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 ServiceName 和 docker-compose.yml 文件在同一个目录,Docker会下载相关镜像。例如下载服务db相关的镜像postgres,你可以运行docker-compose pull db
$ 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