| 1 |
# docker compose pull |
| 2 |
|
| 3 |
<!---MARKER_GEN_START--> |
| 4 |
Pulls an image associated with a service defined in a `compose.yaml` file, but does not start containers based on those images |
| 5 |
|
| 6 |
### Options |
| 7 |
|
| 8 |
| Name | Type | Default | Description | |
| 9 |
|:-------------------------|:---------|:--------|:-------------------------------------------------------| |
| 10 |
| `--dry-run` | `bool` | | Execute command in dry run mode | |
| 11 |
| `--ignore-buildable` | `bool` | | Ignore images that can be built | |
| 12 |
| `--ignore-pull-failures` | `bool` | | Pull what it can and ignores images with pull failures | |
| 13 |
| `--include-deps` | `bool` | | Also pull services declared as dependencies | |
| 14 |
| `--policy` | `string` | | Apply pull policy ("missing"\|"always") | |
| 15 |
| `-q`, `--quiet` | `bool` | | Pull without printing progress information | |
| 16 |
|
| 17 |
|
| 18 |
<!---MARKER_GEN_END--> |
| 19 |
|
| 20 |
## Description |
| 21 |
|
| 22 |
Pulls an image associated with a service defined in a `compose.yaml` file, but does not start containers based on those images |
| 23 |
|
| 24 |
|
| 25 |
## Examples |
| 26 |
|
| 27 |
Consider the following `compose.yaml`: |
| 28 |
|
| 29 |
```yaml |
| 30 |
services: |
| 31 |
db: |
| 32 |
image: postgres |
| 33 |
web: |
| 34 |
build: . |
| 35 |
command: bundle exec rails s -p 3000 -b '0.0.0.0' |
| 36 |
volumes: |
| 37 |
- .:/myapp |
| 38 |
ports: |
| 39 |
- "3000:3000" |
| 40 |
depends_on: |
| 41 |
- db |
| 42 |
``` |
| 43 |
|
| 44 |
If you run `docker compose pull ServiceName` in the same directory as the `compose.yaml` file that defines the service, |
| 45 |
Docker pulls the associated image. For example, to call the postgres image configured as the db service in our example, |
| 46 |
you would run `docker compose pull db`. |
| 47 |
|
| 48 |
```console |
| 49 |
$ docker compose pull db |
| 50 |
[+] Running 1/15 |
| 51 |
⠸ db Pulling 12.4s |
| 52 |
⠿ 45b42c59be33 Already exists 0.0s |
| 53 |
⠹ 40adec129f1a Downloading 3.374MB/4.178MB 9.3s |
| 54 |
⠹ b4c431d00c78 Download complete 9.3s |
| 55 |
⠹ 2696974e2815 Download complete 9.3s |
| 56 |
⠹ 564b77596399 Downloading 5.622MB/7.965MB 9.3s |
| 57 |
⠹ 5044045cf6f2 Downloading 216.7kB/391.1kB 9.3s |
| 58 |
⠹ d736e67e6ac3 Waiting 9.3s |
| 59 |
⠹ 390c1c9a5ae4 Waiting 9.3s |
| 60 |
⠹ c0e62f172284 Waiting 9.3s |
| 61 |
⠹ ebcdc659c5bf Waiting 9.3s |
| 62 |
⠹ 29be22cb3acc Waiting 9.3s |
| 63 |
⠹ f63c47038e66 Waiting 9.3s |
| 64 |
⠹ 77a0c198cde5 Waiting 9.3s |
| 65 |
⠹ c8752d5b785c Waiting 9.3s |
| 66 |
``` |
| 67 |
|
| 68 |
`docker compose pull` tries to pull image for services with a build section. If pull fails, it lets you know this service image must be built. You can skip this by setting `--ignore-buildable` flag. |