--cache-from does not accept tags/digests although Docker does
Description
--cache-from does not accept tags like it does on docker.
Steps to reproduce the issue:
- buildah bud --cache-from foo:bar .
- 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
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.
A friendly reminder that this issue had no activity for 30 days.
Closing this since there was not response but please feel free to re-open.
Could you explain your use-case a bit more ? Since
tagordigestis automatically generated by buildah for the distributed cache. Users only need to provide the repobuildahwill automatically generate acacheKeywhich will be used as thetagfor the cache to bepulledorpushed.
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.
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:
- docker pull imageA:latest
- docker build --cache-from=imageA:latest -f Dockerfile -t imageB:latest .
- 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?