-
Notifications
You must be signed in to change notification settings - Fork 517
Add Windows Dockerfile #92
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
Add Windows Dockerfile #92
Conversation
Expand-Archive go.zip -DestinationPath c:\\ ; \ | ||
Remove-Item go.zip -Force | ||
|
||
RUN setx /M PATH "C:\go\bin;%PATH%" && \ |
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.
You can combine these into a single command to avoid an extra layer. See dockerfile.windows in docker/docker for an example.
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.
The download-unzip and setx instructions? Again, this is structured like the linux image: https://github.com/docker-library/golang/blob/master/1.6/Dockerfile#L20 I don't think there's any harm in having this be separate layers since this sequencing doesn't cause bloat.
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.
Sure, but less layers are quicker....
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.
How? It's the same number of bits over the wire (roughly), and it makes better use of caching because (for example) the RUN setx
command (and subsequent ones) can be changed without having to re-run the the download and un-archive
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.
It's miniscule but every msec counts. But realistically if you're worried about caching, surely the setx should go first? It's more likely the download will change, not the path...
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.
@jhowardmsft but that would be semantically incorrect. Someone building the image and wanting to debug the layer after setx
but before the download would run docker run -ti <layer-hash> cmd
and be in a container with GOPATH and PATH pointing to a non-existent location.
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.
You honestly believe that's a realistic scenario though? I really don't.
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.
Here are some other reasons:
- it's how the Linux Dockerfiles are structured
- It reads better. If I'm scanning the Dockerfile top to bottom I'd see instruction setting PATH to random place not encountered before. Only scanning the next instruction do I realize that it's the eventual destination of the install of what's to come
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.
My $.02 - I truly don't buy that in something so simple. But your call as to what goes into any official images. Just giving my opinion 😄
Neat! Happy to have this discussion! 😄 👍 (@jhowardmsft probably want to wait on the specifics of the PR review until we figure out a few logistics first 😄) A few questions right off the bat come to mind for me:
|
@@ -0,0 +1,12 @@ | |||
FROM windowsservercore |
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.
As on Linux I would see some sort of "buildpack-deps:jessie-scm" base image to have git (and svn, bzr, ...) installed to make go get
work.
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.
@tianon - Ignore the Linux binary bit. That's a client-only thing, not in containers or in server.
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.
@jhowardmsft that makes me kind of sad, and I hope there are plans to change that because being able to docker run -it --rm ubuntu
on Windows sounds really magical and I want it to be a thing 😇
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.
+1, but out of my hands.
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.
Maybe with a Hyper-V "Linux container": docker run -it --rm --isolation=hyperv ubuntu
😄
(reiterating that I think the |
|
||
RUN powershell -Command \ | ||
(New-Object System.Net.WebClient).DownloadFile('%GOLANG_DOWNLOAD_URL%', 'go.zip') ; \ | ||
Expand-Archive go.zip -DestinationPath c:\\ ; \ |
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.
The downloaded zip file should be checked as on Linux. I've added something in a node Docker image https://github.com/StefanScherer/dockerfiles-windows/blob/89f47847d082584c72741850119757414dda3625/node/5.10/Dockerfile#L10
if ((Get-FileHash node.msi -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \
@tianon Sure. I'll shut-up now 😺 |
This is explored here: moby/moby#21975 Currently the base images are assumed to be on the host. The hoped-for design is that the images will exist as tagged entities on Docker Hub, but that they'll be redirects to files hosted by Microsoft that the engine will seamlessly consume. @taylorb-microsoft may have more details.
That's not really the case. I think it's better to think of Windows as a different architecture (but it's really a matrix, because one can conceive of ARM64 Windows Containers too). Same as with CPU architectures, I think the goal is to have the option of Windows and Linux x86_64 images side-by-side in the same tag using manifest lists. @estesp has a prototype tool (I haven't tested it yet): https://github.com/estesp/manifest-tool Until that's baked I think that placing the Windows images in separate tags or in a separate org (like for the non-x86_64 CPU architectures) is great.
The WS2016 tech previews are free to download and Microsoft has setup instructions. You can also boot WS2016 VMs on Azure (@chanezon can perhaps help you get access to an Azure account). @jhowardmsft and Docker currently maintains a fleet of modified WS2016 instances on Azure for the purpose of running CI on Another wiggle is that the latest WS2016 (TP5) is not yet publicly available and we should build the images for that. A version is available to Docker, though. @tianon if you think it's useful, I'd be happy to get on a hangout with you to talk more about how we might do this. |
@StefanScherer thanks for the feedback, added sha-check |
Ok, have had some time to ponder this more (and got access to hardware/software for testing; thanks @friism and @mikedougherty!), and have more thoughts:
|
I would prefer shorter tags. For some tags the manifest tool can be used.
But different tags for eg.
|
Introducing the manifest tool is not something we (the official images team) or the engine are prepared to support fully at this time, so this "variant" option is the patch to get us something usable in the short term while proper support is worked out, and even beyond that for supporting older daemons after we do have proper multi-manifest support worked out. cc @estesp |
@tianon thanks for taking a look! As far as I know, Nanoserver and Windowsservercore do not represent different userlands running on the same kernel. They're different kernels with different ABIs. For that reason, I think it's best for them to be differently named base images vs. different tags of @jstarks has been working on adding the relevant image metadata. Details on getting that wired up here: moby/moby#22816 Combined with manifest lists, this would let the engine/registry auto-negotiate whether to choose between nanoserver and windowsservercore. I can try to add a Nanoserver Dockerfile too, maybe that'll root out some issues. I'm fine with starting with a purely tag-based approach. I'd like to understand what it would take to adopt manifest lists though. Note that the registry does auto-fallback in case the client(daemon) doesn't know about manifest lists (this is determined from the accept header version). In that case, it just serves the Linux image manifest (no manifest list) to the client. Do you have other concerns? Better Docker Hub UI support? cc @glennc @aaronlehmann @MichaelSimons @taylorb-microsoft @jhowardmsft |
Keep in mind that nanoserver images will work anywhere (post-TP5) while windowsservercore images will not work on Nano Server hosts (unless you pass --isolation=hyperv...). And if a user can use nanoserver, then he probably should since it's so much smaller and faster -- there is just a smaller API surface available. So I'm not sure relying on manifest-list-based autodetection is the right thing here. I think the users are going to have to make a decision about which image is right for their use cases. |
@jstarks I was thinking the manifest would be useful in the default experience. For example, if golang:latest is pulled on Ubuntu it would get the Linux variant. If pulled on a Windows Server Core host, it would get the windowsservercore variant. If pulled on a Nano Server host, it would get the nanoserver variant. Now if you want to get a nanoserver based image on Windows Server Core, then you could pull a tagged variant (golang:nanoserver) whose manifest is just tied to Windows. Additionally the manifest would be helpful in blocking the ability to pull windowsservercore based images on Nano Server. |
@MichaelSimons That may be true. I guess the question is whether a Windows Server Core user really wants to default to Windows Server Core or whether we can make Nano popular enough that everyone just wants that. It seems that if we can plumb the information into the images and manifests, then it's just a policy decision that the engine can make at pull time. |
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library#1612, docker-library#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
@tianon it looks like you've made progress on this - awesome! I wanted to update you guys on the latest developments: The Windows base layers have been regularized as normal Docker layer tarballs and will not require out-of-band installation. Currently you can download and I think you should be able to start building prototype Windows library images. I'd recommend running WS2016, installing the base images using the current out-of-band approach and tagging them like For the curious, Microsoft has published a set of Windows images (typically named "-sample") here. Some of the Dockerfiles are here: https://github.com/Microsoft/Virtualization-Documentation/tree/master/windows-container-samples/windowsservercore @tianon can you let us know if you're think you're blocked on missing pieces in the Windows - Docker engine on Windows - Windows base image toolchain? |
Ah, nice! So Regarding |
@tianon yes, And yes, |
@tianon I think the windows base layers on Hub are just about working: moby/moby#25176 (comment) |
That's epic! 😄 (and also points directly at I'll take a look at this again now (especially in the context of the image variant naming discussions that @taylorb-microsoft and I have had) and see if we can finally get this rolling again! 🎉 |
@tianon As we're building out the image naming/versions etc... we are seeing some challenges, @enderb-ms is doing some thinking about this right now - great if you guys can discuss. |
@taylorb-microsoft nice! I'd be happy to do whatever I can to help! Feel free to prod me via email too if you think it'd be easier to discuss/help that way 👍 (or even schedule a hangout or something) |
(following up from call) @tianon for creating windowsservercore container images, I think a WS 2016 TP5 instance on Azure is great. You can really do this any old way that you want, including running the (free) WS2016 TP5 iso in virtualbox on your Mac or Linux machines. nanoserver is going to be a bit more involved, so maybe it should be done later. Either you'd have run WSCore2016 on bare metal and then build nanoserver containers there (bare metal is required because nanoserver requires WSCore2016 will eventually be able to build and run nanoserver containers without hyperv, but that's not useful for us know-if nothing else because we need to create TP5-compatible images. @tianon I'd suggest that you start with windowsservercore images unless you (or someone else) can think of a simple way to build the nanoserver ones too. @enderb-ms @taylorb-microsoft @PatrickLang |
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library/official-images#1612, docker-library/official-images#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
To satisfy both Windows (docker-library/golang#92) building and "non-AUFS" (docker-library/official-images#1612, docker-library/official-images#1537) building ("build machine" constraints, if you will), an update to the manifest file format is necessary. To this end, we're introducing a new format which uses RFC 2822, allowing much more expressivity (especially for additional metadata like `Constraints`) and readability. The new tool also includes backwards compatibility for the older line-based manifest file format, but its usage is discouraged (and we will be slowly converting at least the `docker-library` repos to use the new format in their `generate-stackbrew-library.sh` scripts). One of the tangential benefits of this conversion is a massive increase in the speed of the tool (`bashbrew list --all` on a very fast system with an SSD and a flaming hot cache used to take ~5s and now takes ~0.012s).
This is a canary PR to explore what getting Windows image into the official library would look like.
We'd want to have both
windowsservercore
andnanoserver
derived images, maybe they should be in subfolders like alpine./cc @wol4max @tianon @taylorb-microsoft @StefanScherer @jstarks @jhowardmsft