Repository navigation
Add initial support building Windows docker in docker - #18348
Conversation
|
Oh, this is cool! Thanks! |
|
ping @jhowardmsft |
|
Windows now supports a package management system called One-Get. You can instead use: Install-Package docker -ProviderName chocolatey
Install-Package git -ProviderName chocolateyThe plus being this works from a 100% clean install of Windows with no dependency resolution. But the rest of your workflow is the same after that point. |
|
Very cool :) |
There was a problem hiding this comment.
Wouldn't it better just to have a .go-autogen.ps1 checked in?
There was a problem hiding this comment.
After looking at it, I think so. I started with a few patches, but ended up with more and more regexes to make it work.
|
This is very cool! @jterry75 I own the docker package on Chocolatey, I'll let @StefanScherer figure out how we ship it with chocolatey, whether it should be client-only or both. Maybe we need a separate docker-engine package for this, I'm not sure how the executable would behave on a non-TP4 Windows machine. |
There was a problem hiding this comment.
this is not real wget is it?
There was a problem hiding this comment.
This is PowerShell, not a wget.exe. It is the shortest way to write it in PowerShell I think.
There was a problem hiding this comment.
hmm alright, I don't know much about it, I think it's just an alias. If it's a short alias, then we should probably use the canonical command instead.
|
@jterry75 Thank you for the hint. You do not need to install the docker client on a TP4, because you need to install the Docker Engine on it which needs some more features to be installed ( Installing git with has a slight problem that git could not be found in the currently open PowerShell terminal. Even after logoff and logon I could not find git in PATH. So I keep at the classical way to get Chocolatey installed for now. |
There was a problem hiding this comment.
I don't know if any other options should be set to build the docker engine. My breakthrough was with autogen daemon.
There was a problem hiding this comment.
That's all that's technically needed (what I use for local development). The official cross build uses (you can just echo in hack/make/binary where it does the go build) the following for the Windows binary 64-bit binary:
Buildflags -a -tags autogen netgo static_build sqlite_omit_load_extension apparmor selinux journal btrfs_noversion libdm_no_deferred_remove -installsuffix netgo. Obviously some of those aren't strictly relevant.
ldflags -w
ldflags_static empty
|
@jhowardmsft Do you or someone of the Docker team at Microsoft know if it is allowed to push such a Win2016TP+Docker Vagrant basebox to Atlas, so the community could grow testing, playing, contributing back to Docker on Windows through a Vagrant box more easily? I know how cool it is to run TP4 on Azure, but I'm still happy to have a TP4 locally on my Mac to show it offline as well. A Packer template to reproduce such a Vagrant box can be found here. |
|
I steer clear of licensing questions. But I would be extremely doubtful this would be permitted. |
There was a problem hiding this comment.
Trying to figure out why the cp to bundles. It's invoked on L54 as hack\make.go-autogen.ps1
There was a problem hiding this comment.
I'll remove this line. This was to test whether all the environments were set. I got only library-import but then found out that I have to set the buildtags.
|
@StefanScherer re-TP4 vagrant image in Atlas - I'll look into it. |
|
@StefanScherer what's the status here? I see some comment, are they all addressed? (just a status check ❤️) |
6ae9193 to
bcb0209
Compare
|
@thaJeztah I've rebased and updated the code:
|
|
Thanks @StefanScherer! ping @jfrazelle how should we proceed here? I think some people are on vacation currently, should we wait until after the Holidays? |
|
@StefanScherer I've been doing a bunch of work around bringing up Windows CI (against Windows) and have a slight change of heart here. I don't think at this point we should be duplicating the current hack\make scripts, but rather embrace what's there currently (ie build using sh hack\make.sh). IMO that's a lot less error prone in the longer term. Also there's a lot more bash scripters in the overall docker community right now who can assist debugging what's going on should it at some point fail. That said, sh doesn't (yet) work in a container - we're debugging as to why and hope to have that fixed soon. So for now, I believe you should update this PR to just add the dockerfile.windows. I have also been modifying it so that it works under TP5 builds, and uses the latest version of go/git. You can find that at https://gist.github.com/jhowardmsft/b9413e30ece1d4cf8465. Could you use that version? Or I can open a new PR if that's easier. ❤️ |
|
@jhowardmsft I've seen the PR's regarding Windows CI 👍 Oh, seems we are walking different directions. I'm getting used to PowerShell and posh-git having a git prompt - wow, all native Windows. And now that 😨 OK, I'm just kidding 😃 So no different directions, but coming closer. The gist looks really good. I'll test it on TP4 and figure out what I have to install in addition now in my docker-windows-box. I'll update this PR. |
bcb0209 to
376688d
Compare
|
@jhowardmsft Rebased and took your gist and removed the ps1 scripts 😢 |
|
LGTM :) One step closer to Windows to Windows CI becoming reality! |
|
@StefanScherer Can you rebase on master and force push? That will fix the failing test on Windows CI. Thx. |
Signed-off-by: Stefan Scherer <[email protected]>
376688d to
6c88b8e
Compare
|
@jhowardmsft Rebased. |
|
LGTM ping @jfrazelle for review/merge |
|
super cool! |
Add initial support building Windows docker in docker
|
LGTM |
|
thanks @StefanScherer, really awesome job! |
This PR is a proof of concept to simplify setting up a Windows build environment to build the Docker Engine for Windows.
After following the discussion in #18206 and reading the documentation http://docs.docker.com/opensource/project/software-req-win/ by @jfrazelle I thought there should be an easier way for anybody in the community who wants to start contributing to the effort to bring docker to the Windows platform.
And after testing Docker on TP4 for a while I was sure the time has come to use Docker for a first real task to solve. So I tried to build docker in docker on Windows to keep the host machine clean.
I agree with @jhowardmsft to use just native Windows tools and PowerShell to work on a Windows host. So I tried to follow that path, keeping away from MinGW/Cygwin shells and just use the tools given on Windows plus an absolute minimum number external tools.
To reproduce the build you need
These are the detailed steps by using Chocolatey to install git and clone the PR branch:
The
hack\make.ps1script is used both on the host as well inside the Docker container.Dockerfile.windowsfile to install the tools needed like Go 1.5.1, rsrc, TDM-GCC and so on.bundles\docker.exe.hack\make\.go-autogenwhich the PowerShell script just converts to PowerShell and runs these steps as well.Then as an admin you can replace your Docker Engine with
After updating the Docker EngineI had the effect that some Container images get lost and I had to tag the base container images with the latest tag again. But this stills proofs me that Docker on Windows is the right thing to do and to push forward. And it will change the way we develop and work on Windows as we can see it on Linux.
Thanks to all the effort of the Microsoft team (@ahmetalpbalkan @darrenstahlmsft @taylorb-microsoft ...) to get to this point!
PS: Now I can start contributing as well and not just annoy you with GitHub issues ;-)