Skip to content

Conversation

@amotl
Copy link
Contributor

@amotl amotl commented Jun 9, 2022

Dear Stefan,

this patch accompanies the other patch StefanScherer/packer-windows#316 to the upstream repository to build box images for Windows Server 2022 including Docker.

With both patches, and a locally-built 2022-box image, I have been able to use those container images from both the Microsoft Container Registry and from Docker Hub without further ado:

  • mcr.microsoft.com/windows/servercore:ltsc2022
  • mcr.microsoft.com/windows/nanoserver:ltsc2022
  • docker.io/openjdk:19-windowsservercore-ltsc2022

Otherwise, when trying to launch them on a Windows 2019 machine, it will croak like

docker: a Windows version 10.0.20348-based image is incompatible with a 10.0.17763 host.

It would be so sweet if we could unlock this feature for the community. As soon as the Vagrant box image StefanScherer/windows_2022_docker will be available on Vagrant Cloud, this patch can be integrated. Thank you in advance for taking the time to look into this.

With kind regards,
Andreas.

amotl added 2 commits June 9, 2022 23:56
It needs a patch to the sister repository to build box images for
Windows Server 2022 including Docker.

Reference: StefanScherer/packer-windows#316
- Add reference to Windows Server 2022.
- Generalize references to ready-made box images available from Vagrant
  Cloud. Specifically regarding `2019-box` vs. `2022-box`.
- Update references to tested software versions. It works for me with
  VirtualBox 6.x and Vagrant 2.2.19 on macOS Catalina.
Copy link
Owner

@StefanScherer StefanScherer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @amotl for your contribution!

I've uploaded the windows_2022_docker box to Vagrant Cloud. Let's merge this PR!

@StefanScherer StefanScherer merged commit 6707b54 into StefanScherer:main Jun 10, 2022
@amotl amotl deleted the windows-2022 branch June 10, 2022 16:26
@amotl
Copy link
Contributor Author

amotl commented Jun 10, 2022

Hi Stefan,

thank you very much for the quick turnaround on this matter. We would like to confirm that it works like a charm using your newly uploaded windows_2022_docker box image, see below.

Keep up the spirit and with kind regards,
Andreas.


Appendix

A short intro on what we are working on over at pyveci/racker#4, on behalf of a few screenshots. We hope that the community will like it and we will notify you about any updates on this as we go, possibly accompanied by some other minor patches. Cheers!

(.venv) sink:postroj amo$ racker --verbose run --rm --platform=windows/amd64 mcr.microsoft.com/windows/servercore:ltsc2022 'sh -c "echo Hello, world."'
2022-06-10 17:59:13,656 [racker.cli        ] INFO    : Preparing runtime environment for platform windows/amd64 and image mcr.microsoft.com/windows/servercore:ltsc2022
2022-06-10 17:59:13,656 [postroj.winrunner ] INFO    : Inquiring information about OCI image 'docker://mcr.microsoft.com/windows/servercore:ltsc2022'
2022-06-10 17:59:14,695 [postroj.winrunner ] INFO    : Using host machine box image 2022-box for launching container image mcr.microsoft.com/windows/servercore:ltsc2022
2022-06-10 17:59:14,695 [postroj.winrunner ] INFO    : Installing Windows Docker Machine into /Users/amo/Library/Application Support/racker/windows-docker-machine
Cloning into 'windows-docker-machine'...
remote: Enumerating objects: 467, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 467 (delta 6), reused 13 (delta 4), pack-reused 448
Receiving objects: 100% (467/467), 3.95 MiB | 5.64 MiB/s, done.
Resolving deltas: 100% (245/245), done.
2022-06-10 17:59:16,086 [postroj.winrunner ] INFO    : Checking connectivity to Docker daemon in Windows context '2022-box'
2022-06-10 17:59:16,161 [postroj.winrunner ] WARNING : Docker context 2022-box not online or not created yet
2022-06-10 17:59:16,161 [postroj.winrunner ] INFO    : Docker context is offline, starting VirtualBox VM with Vagrant
Bringing machine '2022-box' up with 'virtualbox' provider...
==> 2022-box: Box 'StefanScherer/windows_2022_docker' could not be found. Attempting to find and install...
    2022-box: Box Provider: virtualbox
    2022-box: Box Version: >= 0
==> 2022-box: Loading metadata for box 'StefanScherer/windows_2022_docker'
    2022-box: URL: https://vagrantcloud.com/StefanScherer/windows_2022_docker
==> 2022-box: Adding box 'StefanScherer/windows_2022_docker' (v2022.06.10) for provider: virtualbox
    2022-box: Downloading: https://vagrantcloud.com/StefanScherer/boxes/windows_2022_docker/versions/2022.06.10/providers/virtualbox.box
Progress: 22% (Rate: 6409k/s, Estimated time remaining: 0:13:38)
Progress: 90% (Rate: 6416k/s, Estimated time remaining: 0:01:43)
    2022-box: Calculating and comparing box checksum...
==> 2022-box: Successfully added box 'StefanScherer/windows_2022_docker' (v2022.06.10) for 'virtualbox'!
[...]
==> 2022-box: Checking if box 'StefanScherer/windows_2022_docker' version '2022.06.10' is up to date...
==> 2022-box: Setting the name of the VM: windows-docker-machine_2022-box_1654877894373_12971
[...]
==> 2022-box: Preparing "all sorts of other things" ;].
[...]
2022-06-10 18:20:33,649 [racker.cli        ] INFO    : Invoking command 'sh -c "echo Hello, world."' on mcr.microsoft.com/windows/servercore:ltsc2022
2022-06-10 18:20:33,649 [postroj.winrunner ] INFO    : Running guest command: sh -c "echo Hello, world."
Hello, world.
$ racker --verbose run -it --rm --platform=windows/amd64 mcr.microsoft.com/windows/servercore:ltsc2022 cmd
C:\>choco install --yes winfetch
C:\>cls
C:\>winfetch

         ,.=:!!t3Z3z.,                 ContainerAdministrator@C25F6EB74450
        :tt:::tt333EE3                 -----------------------------------
        Et:::ztt33EEE  @Ee.,      ..,  OS: Windows Server 2022 Datacenter [64-b
       ;tt:::tt333EE7 ;EEEEEEttttt33#  Host: innotek GmbH VirtualBox
      :Et:::zt333EEQ. SEEEEEttttt33QL  Kernel: 10.0.20348.0
      it::::tt333EEF @EEEEEEttttt33F   Motherboard: Oracle Corporation VirtualB
     ;3=*^```'*4EEV :EEEEEEttttt33@.   Uptime: 3 minutes
     ,.=::::it=., ` @EEEEEEtttz33QF    Packages: 7 (choco)
    ;::::::::zt33)   '4EEEtttji3P*     Shell: PowerShell v5.1.20348.643
   :t::::::::tt33 :Z3z..  `` ,..g.     Resolution: 1024x768
   i::::::::zt33F AEEEtttt::::ztF      Terminal: CExecSvc
  ;:::::::::t33V ;EEEttttt::::t3       CPU: Intel(R) Core(TM) i9-9980HK CPU @ 2
  E::::::::zt33L @EEEtttt::::z3F       GPU: VirtualBox Graphics Adapter (WDDM)
 {3=*^```'*4E3) ;EEEtttt:::::tZ`       Memory: 1.16 GiB / 6 GiB (19%)
             ` :EEEEtttt::::z7         Disk (C:): 0 GiB / 19 GiB (0%)
                 'VEzjt:;;z>*`

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants