docker-lock icon indicating copy to clipboard operation
docker-lock copied to clipboard

feat: when `pull_policy: never` skip query manifests

Open loynoir opened this issue 3 years ago • 0 comments

Given

Given some apps using different settings, but reference to same build local image.

version: "3.6"

networks:
  napp:

services:
  build:
    pull_policy: never
    image: private/image
    build:
      network: foobar
      context: foobar
      dockerfile: foobar.Dockerfile
      args:
        foo: bar
        bar: foo

  app1:
    depends_on:
      - build
    pull_policy: never
    image: private/image
    environment:
      - settings: A

  app2:
    depends_on:
      - build
    pull_policy: never
    image: private/image
    environment:
      - settings: B

Actual

failed to update image with err: 
failed to find digest for 'private/image' with err: 
GET https://index.docker.io/v2/library/private/image/manifests/latest: 
UNAUTHORIZED: authentication required; 
[map[Action:pull Class: Name:library/private/image Type:repository]

Expected

When pull_policy: never, skip query manifests.

Some thoughts

I think pull_policy: never can somehow indicate a local image.

  1. docker-compose pull will skip pull_policy: never section.
  2. Without pull_policy: never, docker-compose pull will fail on local images.
  3. The one who using local image, and want to use docker pull, have no choice but add pull_policy: never.

Current workaround

Move build section down to every else services.

If build sections have X lines, and being refer to Y times, becomes long long XY lines. 😭

loynoir avatar Jul 08 '22 13:07 loynoir