-
Notifications
You must be signed in to change notification settings - Fork 42
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
Adds support for creating Windows scratch-equivalent baselayers #64
Conversation
aab7807
to
16d783a
Compare
e48fd21
to
4a5f630
Compare
I realize I focused mostly on importance of this scratch base layer for A user who is not interested in using Or something similar with a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@micahyoung Thanks for all of your hard work here. I appreciate the effort that went into creating the nice go generate
interface.
I left some comments the mostly boil down to:
- some very minor cleanup in the testhelpers
- can we make the Makefile target smart enough to avoid slow generation steps when possible? If not maybe we should pull it out of the
test
target it leave it to users who edit the bsdgen code to run manually when appropriate?
Required for storing images without Microsoft baselayers on WCOW daemons (i.e. buildpackages) Adds the bcdhive_gen generator for the creation of BCD file, which uses that hivex library which has tricky run-time dependencies on darwin - Replaces testhelper with implementation Signed-off-by: Micah Young <[email protected]>
- Build with current go version Signed-off-by: Micah Young <[email protected]>
Signed-off-by: Micah Young <[email protected]>
Signed-off-by: Micah Young <[email protected]>
Signed-off-by: Micah Young <[email protected]>
4d7a95e
to
50931e4
Compare
f11e338
to
50931e4
Compare
This allows
FROM scratch
-style Windows images (and buildpackages) to be stored on WCOW daemons (required for buildpacks/pack#840).This is needed because
imgutil
inlocal
scenarios requires all images to be stored on a Docker daemon. This works fine for Linux since the Docker daemon has pretty loose validation for Linux images (only requires the correct image metadata). But WCOW daemons, on the other hand, are most strict and require a specific baselayer as well. This difference is likely because there is no currentFROM scratch
use-case for Windows since it's not currently possible to statically compile a Windows binary with enough libraries to run in an empty container.The smallest Microsoft-authored baselayer that can be stored on a daemon is from nanoserver, which is 100MB, has license restrictions for use, is a foreign layer that requires public internet access to pull, changes frequently due to patches, is coupled to the OS version (
nanoserver:2004
images can't be pulled by Windows 1809), and currently has no long-term-supported version. For these reasons, it is unsuitable as a scratch-equivalent baselayer for something like buildpackages.This implementation was derived from the files required by the moby and hcsshim codebases. It creates a layer with the 6 files necessary so an image that uses it can be stored on a daemon. There is no documented API contract for these files unfortunately which is a big downside. However the benefits in contrast to using nanoserver are that it can be generated on the fly on any OS, is created with OSS tools, has no distribution limitations, works with all current daemon versions, is only a few bytes, is trivial enough to hopefully not require regular patches, and if it does need to be patched, can be replaced with
Image.Rebase()
. The images with this layer can also be pulled and inspected with daemon-based tools likedive
and presumably anything using the Docker API.This implementation includes a new generator to create the
imgutil
source file with the encoded content of the most complex file - the baselayer's BCD hive file. This is needed only because the hivex C++ shared library is difficult to compile for OSes besides Linux and would introduce a surprising runtime requirement for consumers ofimgutil
on any OS.I manually tested the layer against the main supported versions of Docker Desktop for Windows (1809, 2004) and Docker for Windows Server (1809, 2004). Additionally, a nearly identical layer has been used as an
imgutil
test fixture for the past several months without issue.