New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scratch should be a special keyword in from scratch, not an image #4242
Comments
+1 - even more nice would be if it were actually a special case to the point that |
mmm, and while we're at it, add some documentation mentioning |
If we're going to make scratch special - do we really need or will it be important that every scratch is identical? |
It's currently extremely important that every scratch is identical, since it's the base layer of all the turtles and it doesn't make sense to have more than one copy of that minimal empty tar, but it'd be much better if it weren't a minimal empty tar at all and was instead a special case altogether. |
I'll change the title. |
I see #5262 closed |
sure looks like this can be closed |
There was some further discussion over there, yes:
Looking at that thread, it's clear that the PR should be closed, but I don't think it's nearly as clear-cut that the whole discussion should be closed. |
I think this issue needs to stay open. I also think that we need to make sure scratch is the same thing everywhere. |
👍 |
@erikh How do you propose treating I've got a current implementation which allows containers to be created with no base image, i.e., an image ID of Would you instead prefer that |
Perhaps a compromise for these 2 camps is the introduction of a new Dockerfile command and behavior. We could add the requirement that the first command be either |
And this wouldn't break backwards compatibility because of course you could still use |
I have no objections at this point. If this makes more sense to do it without FROM, that’s fine. It just seems like a subtle, breaking change, but I feel I may be incorrect about that. I do think we should get @shykes’s opinion before merge if he has one. I’ll review the code tomorrow.
|
I'm having beginning users in mind; making the From that perspective I like an explicit approach. Technically, I agree; it's pretty useless to pull an empty image from the repository (and possibly unwanted for people wearing tinfoil hats). Additionally; having no parent image in But again, from a user perspective, I'd prefer an explicit |
From the point of view of rethinking the future of Dockerfiles, it is very convenient right now that all current Dockerfiles start with FROM. It's a way we could distinguish from future Dockerfiles without having to resort to a VERSION instruction. Not saying this is the way we would go, but it is definitely valuable to keep this option possible. So I would prefer having I do wonder how any of the solutions would impact fragmentation of |
@tiborvass |
@unclejack Our goal is to not use that image ID (511136ea...) or any image ID. Going forward, the distribution team's goal is to optimize away any empty file system layers like this. |
@jlhawn We can make it a no-op in that case, I don't see how this would cause troubles. The Dockerfile would still work on all existing Docker versions and pulling existing images would still work. |
I like the no-op approach, and I think I'm really close to an implementation that everyone can agree on. I feel kind of bad for these guys though: http://scratch.mit.edu/ I guess scratch will never be one of our official language pack base images :( |
@jlhawn @unclejack That's why I offered the "look for image named |
@tiborvass Making |
Fair enough :) I guess we should design review this with @shykes and then we should be all set. |
Let's do the following:
|
if we do this, and since FROM is required right now, can we treat the absence of FROM as the trigger to indicate that we're using the, yet to be written, v2 parser? Then we can use the parser that will be more like the command line parser (deals with quotes, spaces, 's etc... properly). |
@duglin this feels pretty orthogonal from a future v2 parser. We can do all this without any change to the syntax, and without waiting for a much more ambitious change to land. |
I wasn't suggesting that we wait, I was just wondering about what possible triggers we could use to know when to use the new parser vs the old one. Thought this might be a good one - along with possible others that we being discussed. |
@shykes I agree with @duglin on not making it optional right away. I'm +1 for no-op. The only reason it is not as orthogonal from a future v2 parser, is because it is super convenient for a v2 parser to assume that v1 Dockerfiles have a mandatory FROM. And we can always make the decision of making it optional later. The blocker for distribution is that layer ID for |
Fwiw, I'm +1 with Tibors comment. |
I think @duglin/@tibor’s idea is kind of hacky, but I totally understand the point of this and agree 100%. Making changes to the builder — big ones — is basically impossible with the lack of versioning atm. +1 for a no-op but required FROM |
@crosbymichael @jlhawn Even if There were some misunderstandings about back and forths. I looked into git log and issues and PRs: it seems that However, in the last design review session, we have decided to keep So conclusion: we should merge #8827 with |
There has been a lot of discussion (issues 4242 and 5262) about making `FROM scratch` either a special case or making `FROM` optional, implying starting from an empty file system. This patch makes the build command `FROM scratch` special cased from now on and if used does not pull/set the the initial layer of the build to the ancient image ID (511136ea..) but instead marks the build as having no base image. The next command in the dockerfile will create an image with a parent image ID of "". This means every image ever can now use one fewer layer! This also makes the image name `scratch` a reserved name by the TagStore. You will not be able to tag an image with this name from now on. If any users currently have an image tagged as `scratch`, they will still be able to use that image, but will not be able to tag a new image with that name. Goodbye '511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158', it was nice knowing you. Fixes moby#4242 Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
There has been a lot of discussion (issues 4242 and 5262) about making `FROM scratch` either a special case or making `FROM` optional, implying starting from an empty file system. This patch makes the build command `FROM scratch` special cased from now on and if used does not pull/set the the initial layer of the build to the ancient image ID (511136ea..) but instead marks the build as having no base image. The next command in the dockerfile will create an image with a parent image ID of "". This means every image ever can now use one fewer layer! This also makes the image name `scratch` a reserved name by the TagStore. You will not be able to tag an image with this name from now on. If any users currently have an image tagged as `scratch`, they will still be able to use that image, but will not be able to tag a new image with that name. Goodbye '511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158', it was nice knowing you. Fixes moby#4242 Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
We should consider treating 'scratch' as a reserved name and prevent images from being tagged as 'scratch'.
I can see arguments for allowing 'scratch' to be treated as any other image and keeping it the way it is, allowing images to be tagged to this name. However, there seems to be some potential for mild abuse or error by allowing 'scratch' to be tagged.
The text was updated successfully, but these errors were encountered: