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

Windows support #28

Open
awakecoding opened this issue Dec 10, 2020 · 17 comments
Open

Windows support #28

awakecoding opened this issue Dec 10, 2020 · 17 comments
Labels
enhancement New feature or request help wanted Extra attention is needed platform/Windows/Non-WSL2 Microsoft Windows (non-WSL2)

Comments

@awakecoding
Copy link

I am looking for a way to use containerd on Windows Server 2019 with a Docker CLI replacement like this one. I see there are Linux builds, but has a Windows port been attempted?

Long story short, containerd for Windows should handle graceful shutdowns for containers, but the current version of Docker is still using HCS v1 + some really broken stuff under the hood, meaning Windows containers have never supported graceful shutdowns (microsoft/Windows-Containers#16).

There is no clear migration path for Docker to adopt containerd on Windows in the short term, so I would be fine with installing containerd on Windows (https://kubernetes.io/docs/setup/production-environment/container-runtimes/#install-containerd) but then I just need a proper CLI on top of it, other than 'ctr' which is very primitive and marked as unsupported/unstable.

I am not familiar with Go, but how difficult would it be to attempt a Windows port of this tool?

@AkihiroSuda AkihiroSuda added enhancement New feature or request help wanted Extra attention is needed labels Dec 10, 2020
@AkihiroSuda
Copy link
Member

Contribution is wanted 😃

@jsturtevant
Copy link
Contributor

I took a quick look and it would be doable but would require some work, there are assumption that this would run on linux like (there are probably more):

nerdctl/exec.go

Line 229 in 06f3a7c

allCaps, err := cap.Current()

nerdctl/run.go

Lines 762 to 766 in 435f533

for _, c := range cap.Known() {
// "CAP_SYS_ADMIN" -> "sys_admin"
s := strings.ToLower(strings.TrimPrefix(c, "CAP_"))
fmt.Fprintln(w, s)
}

if err := Flock(dirFile, unix.LOCK_EX); err != nil {

fn := func(_ ns.NetNS) error {

@jsturtevant
Copy link
Contributor

I got started on this. Will likely want to break this down into many different PRs

@AkihiroSuda
Copy link
Member

Thanks!

@jsturtevant
Copy link
Contributor

Got it to build and connect 🚀

PS C:\projects\nerdctl\_output> .\nerdctl.exe ps -a
CONTAINER ID    IMAGE                                        COMMAND                   CREATED          STATUS                   PORTS    NAMES
multi-arch      k8s.gcr.io/pause:3.4.1                       "/pause.exe"              3 days ago       Created
multi-arch2     k8s.gcr.io/pause:3.4.1                       "/pause.exe"              8 minutes ago    Created
multi-arch3     k8s.gcr.io/pause:3.4.1                       "/pause.exe"              8 minutes ago    Up
test            mcr.microsoft.com/windows/nanoserver:20H2    "echo hello"              9 days ago       Exited (1) 9 days ago
test-1          mcr.microsoft.com/windows/nanoserver:20H2    "echo c:\\License.txt"    9 days ago       Exited (1) 9 days ago
test2           k8s.gcr.io/pause:3.4.1                       "/pause.exe"              7 days ago       Created

Needs some more work to be able to run containers

@jsturtevant
Copy link
Contributor

I was able to get nerdctl run to work! But I did run into issues running multi-arch docker manifests (containerd/containerd#5297) which should be resolved by containerd/containerd#5298.

.\nerdctl.exe run --name nerdclttest1 mcr.microsoft.com/windows/nanoserver:20H2
Microsoft Windows [Version 10.0.19042.867] 
(c) 2019 Microsoft Corporation. All rights reserved.                                                                                                                                                                                            C:\Windows\system32>                     

Although it is rough, I opened #164 just to show the work involved. I would propose breaking this down into at least two PRs for easier reviewing:

  1. split out the Logic that is tied to Linux to their separate files so that we can build the windows binary. This would allow producing and .exe but functionality would be limited. From my testing nerdctl ps would work and maybe some other basic commands.
  2. Add in run support which requires a bit more refactoring.
  3. After that we can approach each other functionality iteratively from there.

What do you think @AkihiroSuda?

@AkihiroSuda
Copy link
Member

SGTM, thanks

@awakecoding
Copy link
Author

I am revisiting this ticket since Rancher Desktop 0.5 just added initial nerdctl support. My understanding is that the latest version of nerdctl doesn't support Windows containers, unless one builds a branch from @jsturtevant from source + installs containerd.exe manually?

@AkihiroSuda
Copy link
Member

I am revisiting this ticket since Rancher Desktop 0.5 just added initial nerdctl support. My understanding is that the latest version of nerdctl doesn't support Windows containers, unless one builds a branch from @jsturtevant from source + installs containerd.exe manually?

Yes. Help wanted to move #197 forward

@AkihiroSuda AkihiroSuda pinned this issue Sep 30, 2021
@jsturtevant
Copy link
Contributor

should we close this? I've opened a few other issues to track the next steps in windows support, otherwise this could be used as an epic?

@jsturtevant
Copy link
Contributor

@AkihiroSuda
Copy link
Member

I think we can keep opening this

@brwilkinson
Copy link

I was wondering what the current status is for Windows support ?

Based on below, can I assume this issue can be closed now?

Was there anything in particular outstanding?

@TBBle
Copy link
Contributor

TBBle commented Sep 3, 2023

https://github.com/containerd/nerdctl/issues?q=is%3Aissue+label%3Aplatform%2FWindows%2FNon-WSL2+is%3Aopen are the outstanding issues. (Same list as #28 (comment), but the label has been renamed since that comment was made.)

I have no strong opinion on whether we should keep this issue open or not. This issue does appear to lack clear (unmet) success criteria though.

@AkihiroSuda
Copy link
Member

This issue does appear to lack clear (unmet) success criteria though.

We still need to support builds and compose AFAICS.
It would be also nice to have a double clickable “SETUP.EXE” too.

@TBBle
Copy link
Contributor

TBBle commented Sep 3, 2023

#627 exists for building, it is currently blocked on microsoft/Windows-Containers#34 and through to buildkit and related. Once we have buildkitd for WCOW stable, hopefully the integration won't be too far from how it's used on non-Windows.


I know approximately nothing about compose, nor the compose support in nerdctl. I don't yet see a ticket for it to work on Windows, so I'm guessing not much time has been spent on that yet, given we're still lacking build support.


Are you thinking of a simple installer for nerdctl.exe, or more like the "Full" binary release, bundling the whole (Windows-supported) stack of dependencies with service setup etc?

Or perhaps something different? We could recreate something like MS's existing containerd/nerdctl script, perhaps.

@AkihiroSuda
Copy link
Member

Are you thinking of a simple installer for nerdctl.exe, or more like the "Full" binary release, bundling the whole (Windows-supported) stack of dependencies with service setup etc?

I’m expecting the latter one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed platform/Windows/Non-WSL2 Microsoft Windows (non-WSL2)
Projects
None yet
Development

No branches or pull requests

5 participants