Compose: Pull fails even if a service defines a build/context

Created on 13 Dec 2017  路  5Comments  路  Source: docker/compose

The docs say

If the image does not exist, Compose attempts to pull it, unless you have also specified build, in which case it builds it using the specified options and tags it with the specified tag.

https://docs.docker.com/compose/compose-file/#image

I have this minimal manifest:

version: '2'
services:
  scheduler:
    image: scheduler:local
    build:
      context: .

But, when I run pull, I get an error and pulling _stops_ at that image (this is not a problem for the example, but for production manifests, it might stop pulling halfway through).

$ docker-compose pull
...
Pulling scheduler (scheduler:local)...
ERROR: pull access denied for scheduler, repository does not exist or may require 'docker login'

I guess I expected it to just pass by the scheduler service (in the case of the minimal example, it would just finish and do nothing else, in the case of a bigger manifest, it would continue pulling other service images).

arecli kinquestion

Most helpful comment

On further thought, using --ignore-pull-failures to avoid this error has the potential to _hide_ real errors. Sure, you _should_ read the console output, but that only works when you're running the command manually. It doesn't help in a scripted scenario where you're depending on the exit status.

If a service has a build section defined, then that indicates that there's no registry to pull from, right?

All 5 comments

I believe you're looking for --ignore-pull-failures

Yes, thank you!

On further thought, using --ignore-pull-failures to avoid this error has the potential to _hide_ real errors. Sure, you _should_ read the console output, but that only works when you're running the command manually. It doesn't help in a scripted scenario where you're depending on the exit status.

If a service has a build section defined, then that indicates that there's no registry to pull from, right?

Totally agree with @AnthonyMastrean!

Related to #3660?

Was this page helpful?
0 / 5 - 0 ratings