buildah icon indicating copy to clipboard operation
buildah copied to clipboard

--cache-from does not accept tags/digests although Docker does

Open vegai opened this issue 3 years ago • 1 comments

Description

--cache-from does not accept tags like it does on docker.

Steps to reproduce the issue:

  1. buildah bud --cache-from foo:bar .
  2. OR podman buildx build --cache-from foo:bar .

Describe the results you received:

Error: unable to parse value provided `` to --cache-from: repository must contain neither a tag nor digest: docker.io/library/foo:bar

Describe the results you expected:

Buildah/podman accepting tag/digest. Docker accepts them, and notably defaults to latest if they are omitted. This makes podman not quite work as a docker replacement, at least for me.

Output of buildah version:

buildah version 1.28.0 (image-spec 1.0.2-dev, runtime-spec 1.0.2-dev)
podman version 4.2.1

vegai avatar Oct 07 '22 09:10 vegai

Hi @vegai ,

Could you explain your use-case a bit more ? Since tag or digest is automatically generated by buildah for the distributed cache. Users only need to provide the repo buildah will automatically generate a cacheKey which will be used as the tag for the cache to be pulled or pushed.

flouthoc avatar Oct 10 '22 06:10 flouthoc

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Nov 10 '22 00:11 github-actions[bot]

Closing this since there was not response but please feel free to re-open.

flouthoc avatar Nov 10 '22 05:11 flouthoc

Could you explain your use-case a bit more ? Since tag or digest is automatically generated by buildah for the distributed cache. Users only need to provide the repo buildah will automatically generate a cacheKey which will be used as the tag for the cache to be pulled or pushed.

Compatibility with docker basically, it seems docker is pulling it's cache manifest from a specific tag. If I leave away the tag it might fail to pull from a non-existing latest tag.

#5 importing cache manifest from eu.gcr.io/project/repo #5 sha256:af6f93e15d901e676c3dc45f0ed4254d626c696316c015fea0e362017ae8d808 #22 [auth] project/repo:pull token for eu.gcr.io #5 importing cache manifest from eu.gcr.io/project/repo #5 sha256:af6f93e15d901e676c3dc45f0ed4254d626c69[63 #5 ERROR: eu.gcr.io/project/repo:latest: not found

This is in a setup with BUILDKIT_INLINE_CACHE=1, I guess we could explicitly use --cache-to on that repo to push cache manifests to the :latest tag, though it would be cleaner to use sth. like :buildcache.

MartinNowak avatar Feb 15 '23 15:02 MartinNowak

Hey, @flouthoc

I'm faced with the following problem and I can describe you the use-case. Currently we use docker to build images, but we are interested to switch from docker to podman. In some pipelines we use --cache-from option to re-use the layers from the previous built image in docker, like that:

  1. docker pull imageA:latest
  2. docker build --cache-from=imageA:latest -f Dockerfile -t imageB:latest .
  3. docker push imageB:latest

We use --cache-from to provide some kind of "idempotency" - it guarantees that the imageB has the same versions of the packages (the versions of the packages are not fixed in the RUN step) if the RUN step which install packages hasn't changed.

However the podman uses another approach - the cache must be located at the repo side, so above-mentioned approach doesn't work for podman. Is there a way to seamlessly/smoothly migrate from docker to podman and to preserve the same layers which are presented in the current images built by docker?

gilgameshfreedom avatar Apr 11 '23 12:04 gilgameshfreedom