Skip to content
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

manifest: Explicitly make 'layers' optional #407

Conversation

wking
Copy link
Contributor

@wking wking commented Oct 20, 2016

Most folks will distribute images containing layers, but the specified behavior applies cleanly to the layer-less case too. The unpacked rootfs will just be an empty directory with unspecified attributes.
Folks might want to use that sort of thing for namespace pinning, distributing configs, setting up containers that mount the meat from the host, etc.

Spun off from #318 to focus on a single point.

Most folks will distribute images containing layers, but the specified
behavior applies cleanly to the layer-less case too.  The unpacked
rootfs will just be an empty directory with unspecified attributes.
Folks might want to use that sort of thing for namespace pinning [1],
distributing configs [2], setting up containers that mount the meat
from the host [2], etc.

[1]: opencontainers/runtime-spec#395 (comment)
[2]: opencontainers#313 (comment)

Signed-off-by: W. Trevor King <[email protected]>
@glestaris
Copy link
Contributor

+1 from me.

I realise there were other issues/PRs trying to make layers list optional that are now closed. What is the main argument against this change?

@jonboulle
Copy link
Contributor

jonboulle commented Oct 21, 2016

LGTM. What do you think about adding some language to one of the documents describing the use cases?

Approved with PullApprove

@wking
Copy link
Contributor Author

wking commented Oct 21, 2016

On Fri, Oct 21, 2016 at 03:45:12AM -0700, George Lestaris wrote:

What is the main argument against this change?

As far as I can tell, just uncertainty about the usefulness. I agree that there aren't extremely convincing use cases, but there are a few (referenced in the topic post here). And in the absence of a good reason to impose the current restriction, I think we should lift it.

On Fri, Oct 21, 2016 at 03:54:58AM -0700, Jonathan Boulle wrote:

LGTM. What do you think about adding some language to one of the documents describing the use cases?

I can do that if you like. But I imagine folks who want to make images without layers will already have a use case in mind, and folks who want to make images with layers won't care about layer-less use cases, so I'm also fine leaving it as it stands (with some use cases in the commit message to motivate the change, but none in the diff itself).

@wking
Copy link
Contributor Author

wking commented Oct 25, 2016

On Fri, Oct 21, 2016 at 03:54:58AM -0700, Jonathan Boulle wrote:

LGTM. What do you think about adding some language to one of the
documents describing the use cases?

I can do that if you like. But I imagine folks who want to make
images without layers will already have a use case in mind, and folks
who want to make images with layers won't care about layer-less use
cases, so I'm also fine leaving it as it stands (with some use cases
in the commit message to motivate the change, but none in the diff
itself).

@jonboulle
Copy link
Contributor

@wking the reason I asked that is because given the countner-argument is
about usefulness, it might be better to clearly justify the usefulness ;-)

On 21 October 2016 at 16:47, W. Trevor King [email protected]
wrote:

On Fri, Oct 21, 2016 at 03:45:12AM -0700, George Lestaris wrote:

What is the main argument against this change?

As far as I can tell, just uncertainty about
#313 (review) the
usefulness
#318 (comment).
I agree that there aren't extremely convincing use cases, but there are a
few (referenced in the topic post here). And in the absence of a good
reason to impose the current restriction
#313 (comment),
I think we should lift it.

On Fri, Oct 21, 2016 at 03:54:58AM -0700, Jonathan Boulle wrote:

LGTM. What do you think about adding some language to one of the documents
describing the use cases?

I can do that if you like. But I imagine folks who want to make images
without layers will already have a use case in mind, and folks who want to
make images with layers won't care about layer-less use cases, so I'm also
fine leaving it as it stands (with some use cases in the commit message to
motivate the change, but none in the diff itself).


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#407 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACewNw1iKSXinSdIN5Eg3g-NR1sW56hKks5q2NCAgaJpZM4KcbbA
.

@wking
Copy link
Contributor Author

wking commented Oct 25, 2016 via email

@stevvooe
Copy link
Contributor

@wking Could you sum those up into a cohesive argument, rather than linking us to 30 scattered comments?

@wking
Copy link
Contributor Author

wking commented Oct 25, 2016

On Tue, Oct 25, 2016 at 11:32:59AM -0700, Stephen Day wrote:

@wking Could you sum those up into a cohesive argument, rather than
linking us to 30 scattered comments?

My cohesive argument is in the topic post here.

@wking
Copy link
Contributor Author

wking commented Oct 25, 2016

On Tue, Oct 25, 2016 at 11:25:31AM -0700, Jonathan Boulle wrote:

@wking the reason I asked that is because given the countner-argument is
about usefulness, it might be better to clearly justify the usefulness ;-)

I agree that it is good to justify the usefulness in this PR and
commit message to motivate the change in the spec. I'm just not
clear that it's worth justifying the lack of restriction in the spec
itself. For many optional settings we don't have in-spec wording
justifying the optionallity.

If we're going to add it, we probably have to go into more details
about the use cases I float in the topic post than I do there (linking
to GitHub comments is fine for commit messages and PR discussion, but
seems less appropriate in the spec itself ;). If you find my “I don't
think we want the use-cases in the spec” arguments unconvincing, would
you like me to unpack all of that in the ‘layers’ entry itself, or do
you want me to put them somewhere else where they're less distracting
to folks who care more about the normative spec than the informative
background?

@stevvooe
Copy link
Contributor

@wking Ok, so you ship a container without a filesystem. In docker parlance, we run the following:

$ docker run -it scratch

What could this actually do?

Following from that, let's assume you convinced me the above is not silly:

docker run -it -v /usr/bin:/usr/bin scratch sh

What did we gain versus an empty tar file that makes the empty layers explicit?

@wking
Copy link
Contributor Author

wking commented Oct 28, 2016

On Thu, Oct 27, 2016 at 02:33:59PM -0700, Stephen Day wrote:

@wking Ok, so you ship a container without a filesystem. In docker
parlance, we run the following:

$ docker run -it scratch

What could this actually do?

Probably nothing, although there are currently gaping holes in the
image → runtime-config translation (1 and #87). If those holes are
filled with something that configures linux.namespaces to create new
namespaces (for all known namespace types?), then the container you
create above would pin its mount namespace 2. You could launch a
sub-container joining that pinned mount namespace, have the
subcontainer do something interesting, and collect the results from
the pinned mount namespace after the subcontainer died. Without
namespace pinning, the interesting results might get removed when the
kernel reaped the mount namespace.

Or maybe the scratch config sets up networking and a volume mount to
bind the host's BusyBox and a home directory, and uses BusyBox's httpd
command to serve that bind-mounted home directory.

And if/when the image spec starts distributing runtime-spec configs
instead of the current image-spec configs, this sort of thing will no
longer need to rely on unpack-time namespace injection or run-time
volume-mount completion.

Following from that, let's assume you convinced me the above is not
silly:

docker run -it -v /usr/bin:/usr/bin scratch sh

What did we gain versus an empty tar file that makes the empty
layers explicit?

I can create a manifest that contains no layers using jq. I'd need to
also pull in tar or dd if I wanted to make an empty tarball. And gzip
unless something like #332 or #388 lands. And that layer blob is one
extra round-trip when pushing or pulling from the registry. So
including an empty layer is not the end of the world, but it seems
like a silly hoop to jump through to satisfy a “must contain at least
one layer” constraint that has no known purpose.

@stevvooe
Copy link
Contributor

If layers is optional, is rootfs optional, as well?

@wking
Copy link
Contributor Author

wking commented Nov 16, 2016

On Wed, Nov 16, 2016 at 02:54:10PM -0800, Stephen Day wrote:

If layers is optional, is rootfs optional, as well?

I am in favor of an optional ‘rootfs’ 1, but I see that as an
orthogonal issue. With an empty layers, the unpacked bundle would
have a rootfs directory attributes are unspecified 2. The
currently-required root.path would point at that directory 3, which
must sit next to the config.json 4.

What the runtime does with that root.path is not an image-spec
concern, but if you're creating a new mount namespace (most likely for
configs unpacked from images), the runtime will pivot into that empty
directory. If you're joining an existing mount namespace or leaving
the container process in the host mount namespace, the runtime will
presumably ignore root.path [5](although “not creating a new mount
namespace” is not a concept that the current runtime-spec addresses
clearly).

 Subject: Dropping the rootfs requirement and restoring arbitrary bundle
  content
 Date: Wed, 26 Aug 2015 12:54:47 -0700
 Message-ID: <[email protected]>

@stevvooe
Copy link
Contributor

From your response, it looks like you have no clue what field I'm talking about. Apologies for not being more precise.

I'm referring to the rootfs field on image config.

@wking
Copy link
Contributor Author

wking commented Nov 17, 2016

On Wed, Nov 16, 2016 at 06:19:15PM -0800, Stephen Day wrote:

I'm referring to the rootfs field on image config.

Ah, thanks for clarifying. I see a few possible approaches. In order
of decreasing preference:

a. Land #451. Freeze application/vnd.oci.image.config.v1+json (which
currently requires rootfs, rootfs.type, and rootfs.diff_ids. After
a few years, remove the requirement that runtimes support
application/vnd.oci.image.config.v1+json and drop it from the spec.

b. Drop rootfs.type (#224). Make rootfs and rootfs.diff_ids optional,
regardless of whether layers is set. When both layers and
rootfs.diff_ids are set, require a one-to-one mapping between
entries.

c. Keep rootfs and rootfs.type required (the current spec). Make
rootfs.diff_ids optional, regardless of whether layers is set.
When both layers and rootfs.diff_ids are set, require a one-to-one
mapping between entries.

d. Keep rootfs, rootfs.type, and rootfs.diff_ids required (the current
spec). Require a one-to-one mapping between entries in
rootfs.diff_ids and layers. When layers is not set, require an
empty array for rootfs.diff_ids.

(d) is pretty much where this PR stands now, although I can add
clarification wording to the diff_ids docs if that's the approach we
want to take.

Personally I don't have a strong opinion on the future of
application/vnd.oci.image.config.v1+json (since I see it being
replaced by the runtime config, #451). Do you have a preference among
those approaches?

@stevvooe
Copy link
Contributor

stevvooe commented Nov 17, 2016

Rejected.

Since this clearly hasn't been thought through, I propose that we close this PR.

@wking How can you possibly propose that runtime config could be a viable replacement for image config? Runtime config is for runtime.

Rejected with PullApprove

@wking
Copy link
Contributor Author

wking commented Nov 17, 2016

On Thu, Nov 17, 2016 at 02:26:50PM -0800, Stephen Day wrote:

Since this clearly hasn't been thought through, I propose that we
close this PR.

What is the missing piece? If it is config rootfs handling, are none
of the options I lay out in 1 acceptable? (a) and (b) have separate
PRs, and the (b) PR has already been rejected, but can you explain
your concerns with (c) and (d)?

@wking How can you possibly propose that runtime config could be a
viable replacement for image config? Runtime config is for runtime.

This is #451. I think that's a solid proposal, but for the purpose of
this PR lets say it's not on the table. That still leaves (c) and (d)
on the table 1, and those both sound like reasonable ways forward to
me.

coolljt0725 added a commit to coolljt0725/image-spec that referenced this pull request Nov 18, 2016
We doesn't define a `base image`, use `base layer` is
correct. This issue first being addressed in pr opencontainers#312,
and then being addressed in pr opencontainers#318, and then in pr opencontainers#407,
but landing opencontainers#407 has a long way to go. We could addressed
this first to avoid confusing.

Signed-off-by: Lei Jitang <[email protected]>
@stevvooe
Copy link
Contributor

@wking Do you even have an analysis of doing nothing? That seems like the option with the smallest impact. It seems that you've only suggested options which you possibly agree with. If (c) or (d) are an option, we may be under-specified. The spec should read towards (d), but requires due diligence before doing so.

This is #451. I think that's a solid proposal, but for the purpose of
this PR lets say it's not on the table. That still leaves (c) and (d)
on the table [1], and those both sound like reasonable ways forward to
me.

#451 continues to propagate the fallacy that image config and runtime config are equivalent entities and that having them be so tightly related leads to solid design. I have left a rejection message on the issue outlining the main problems with the proposal.

@wking
Copy link
Contributor Author

wking commented Nov 22, 2016

On Mon, Nov 21, 2016 at 12:24:14PM -0800, Stephen Day wrote:

@wking Do you even have an analysis of doing nothing?

As in “closing this PR”? That just means folks who want an empty
rootfs need to jump through some extra hoops 1. I agree that it has
low impact on the spec (tautologically?), but I see no reason to
require that hoop jumping.

If (c) or (d) are an option, we may be under-specified. The spec
should read towards (d), but requires due diligence before doing so.

I think the current spec is clear enough on this point, requiring both
rootfs.diff_ids (in the config) and layers (in the manifest). This PR
is interested in making layers optional. I don't really care if
rootfs.diff_ids becomes optional or not (which is why (c) and (d) are
both on the table). As this PR stands, rootfs.diff_ids is still
clearly required 2. If you like (d) better than (c), I can add
wording like:

If the manifest's layers is empty or unset, diff_ids MUST be an
empty array.

But that's mostly to help orient people. I think the spec would be
unambigous (but with slightly less context) without such an addition.

@stevvooe
Copy link
Contributor

@wking What can you exec in the container if there is no rootfs?

@wking
Copy link
Contributor Author

wking commented Jan 19, 2017 via email

@stevvooe
Copy link
Contributor

@wking I don't see the value in rehashing this pre-1.0.

Let's revisit this after a release.

@stevvooe stevvooe closed this Jan 20, 2017
@wking
Copy link
Contributor Author

wking commented Jan 20, 2017 via email

@jonboulle jonboulle added this to the post-v1.0.0 milestone Jan 23, 2017
@jonboulle jonboulle reopened this Jan 23, 2017
@wking wking mentioned this pull request Feb 6, 2017
@vbatts
Copy link
Member

vbatts commented Mar 8, 2017

I feel that this should not be explicitly called out. If a use-case is binding mounting root from the host, then they can use a 512byte+1024byte empty tar archive (header + nil bytes).

@stevvooe stevvooe closed this Mar 8, 2017
@stevvooe
Copy link
Contributor

stevvooe commented Mar 8, 2017

Closing per discussion on OCI meeting, 3/8.

@wking
Copy link
Contributor Author

wking commented Mar 9, 2017 via email

@glestaris
Copy link
Contributor

@vbatts workaround seems viable TBH. It's a bit of an ugly workaround but I don't have a real use case that opposes it right now.

@vbatts
Copy link
Member

vbatts commented Mar 9, 2017

@glestaris good to hear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants