Replies: 9 comments 1 reply
-
I'll tag in @nalind and @rhatdan here for opinions. I do recall that we have been reluctant in the past to extend the syntax of Dockerfiles, to prevent a split in supported syntaxes between Podman/Buildah and other tools. |
Beta Was this translation helpful? Give feedback.
-
I am traveling and have not been able to concentrate on this. But this could be something we could extend with Containerfile support as opposed to Dockerfile. |
Beta Was this translation helpful? Give feedback.
-
There may be a better place to discuss this; totally agree that were we to try this, the benefit is much greater if it's "standardized" by being shared with docker/moby. This isn't a burning urgent issue or anything. But I just wanted to get it written down in a persistent place so I can link to it and we can potentially revisit it at some point. |
Beta Was this translation helpful? Give feedback.
-
I have a hard time wrapping my head around it. My first impression is that multi-stage builds allow for selectively copying data from other images/layers. |
Beta Was this translation helpful? Give feedback.
-
@cgwalters Please correct me if i missed anything or interpret anything wrongly. I just have few doubts. What would be the exact behavior of I might be interpreting this wrongly but doesn't So how is this fundamentally different from calling explicit
Do we need something like |
Beta Was this translation helpful? Give feedback.
-
Transformed into a discussion ✔️ |
Beta Was this translation helpful? Give feedback.
-
A good example of a power this approach would have that can't be done with |
Beta Was this translation helpful? Give feedback.
-
Bumping this a bit as it's still relevant, and to xref with coreos/rpm-ostree#4688 I'm a bit uncertain. Maybe what could work is instead of trying to add magic new podman-only instructions, we gate all of this under Maybe something like
And |
Beta Was this translation helpful? Give feedback.
-
Today,
Dockerfile
is basically the lowest common denominator of the container ecosystem. There are better tools to build container images out there; I'm filing this because it relates to this ostree-container issue but really I foundhttps://grahamc.com/blog/nix-and-layered-docker-images
very inspirational. I honestly hadn't fully internalized the fact that it's possible to build Docker/OCI images in a not-completely-stupid way until seeing that post.
However: one really can't do this from
Dockerfile
. The core semantic is that eachRUN
invocation generates a new layer. Choices such as when and how to squash aren't in control of the container.Here's my strawman proposal: Something like:
OUTPUT /layers
When specified,
/layers
will already have a pre-populated directory/layers/input/blobs/sha256
with blobs chosen by the build system that do not need to be regenerated by this build. This could be empty, but e.g. a simple useful implementation might pre-populate it with layers from the previous build of the same image tag.Hmm, and a build system would need some way to name those blobs, so maybe something like
/layers/history.json
which corresponds to the entries in the config history, so the build system can e.g. insert into its builds something like "bash-5.2.0-3-amd64.deb" or whatever and map from that to the blob sha256.Then finally, the build system can output any new blobs to
/layers/output/blobs/sha256
.Basically, what this would allow is something like:
And we wouldn't even need a multi-stage build here - the in-container build process itself gets to have much more power over the generation of the final image. IOW here the final image wouldn't derive from
quay.io/nixos/nix
or whatever at all (usually).Beta Was this translation helpful? Give feedback.
All reactions