skaffold can't find image it has just build

6/16/2020

I have the following skaffolding

build:
  tagPolicy:
    sha256: {}
  artifacts:
    - image : sdk
      context: docker
      docker:
        dockerfile: Dockerfile.sdk
        buildArgs:
          CONFIGURATION: Debug
    - image : app
      context: docker
      docker:
        dockerfile: Dockerfile.app
        buildArgs:
          CONFIGURATION: Debug
    - image: azu
      context: rt/azu/src
      docker:
        dockerfile: Dockerfile.worker
        buildArgs:
          VERSION : Debug

The first two images are built just fine. Whereas the third fails. The second build depends on the first and the third depends on the second. However the third fails with "MANIFEST_UNKNOWN: manifest unknown" because it tries to retrieve it from docker hub. If I change the context of the third build to docker (which will make the building of the image fail) skaffold finds the local image. What can I do to keep the correct context and make skaffold aware that it shouldn't pull from docker hub but use the locally build image?

-- Rune FS
kubernetes
skaffold

1 Answer

7/9/2020

(Aside: It's difficult to help if you don't include your full skaffold.yaml and your Dockerfiles. Just redact pieces that are private.)

Skaffold "just" orchestrates the builds and has no influence over how the underlying builders resolve images. But Skaffold does instruct the underlying builders how the resulting image should be tagged. Skaffold provides a set of tagging policies.

So it sounds like your rt/azu/src/Dockerfile.worker has a FROM that is not referencing your app image — perhaps the image is being tagged differently than what you're referencing. Skaffold's default tagger uses the git commit, resulting in image references like app:v1.12.0-37-g6af3198f3-dirty.

If my suspicion is true, then you'll want to use the envTemplate tagger so that your built images use a more controlled and predictable image tag that you can embed into your Dockerfiles.

-- Brian de Alwis
Source: StackOverflow