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 part 1 #184

Merged
merged 1 commit into from
Apr 28, 2021
Merged

Windows part 1 #184

merged 1 commit into from
Apr 28, 2021

Conversation

jsturtevant
Copy link
Contributor

This is the first part step of adding Windows support. See #28 (comment) for the plan to do this in stages. This is focused on make it build and mostly move Linux specific functionality to _linux.go files and stubs in _windows.go files. The next PR will add ability to nerdctl run containers

Having all the changes in one PR (#164) made it difficult to see where differences were introduced and felt riskier than doing it in stages and should make reviewing faster.

This only enables Nerdctl to be built on Windows. It doesn't add full support, which will come in later PR's. Some functionality does work though, such as :

Pulling images

PS C:\projects\nerdctl\_output> .\nerdctl.exe pull jsturtevant/pause:3.6-windows-amd64-20H2
docker.io/jsturtevant/pause:3.6-windows-amd64-20H2:                               resolved       |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:f0aad192a1b106ae51e3eef56d5f807830c97c2a086b038e3e04fcca34d2c0b2: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:23388efa1a0be06e8962f8fc8a756c860441b2402ededa8f098b055e7368a630:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:e4ebc87f3dce90c29691c1e41b3b18715d02b40889528750271bdf1ac116d8d9:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:9ef56e96c7a394f4f55704ab032a9092c38e27435e711a85ad3712de7e5b2b09:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:48ac2dabfb13cb3463b3938efc623ad9815a5d261b96b48eeeaf52eab055ba40:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:033263e01d18471a352ee800110d55b007ef31690c6fc40c1f97769ff84460d4:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 59.8s                                                                    total:  1.3 Mi (23.1 KiB/s)      

listing images

PS C:\projects\nerdctl\_output> .\nerdctl.exe image ls
REPOSITORY           TAG                       IMAGE ID        CREATED               SIZE
jsturtevant/pause    3.6-windows-amd64-20H2    f0aad192a1b1    About a minute ago    101.2 MiB

listing running containers

PS C:\projects\nerdctl\_output> .\nerdctl.exe ps
CONTAINER ID    IMAGE                                                 COMMAND         CREATED               STATUS    PORTS    NAMES
container1     docker.io/jsturtevant/pause:3.6-windows-amd64-20H2    "/pause.exe"    About a minute ago    Up          

listing namespaces:

PS C:\projects\nerdctl\_output> .\nerdctl.exe namespace ls
NAME       CONTAINERS    IMAGES    VOLUMES
default    1             1         0

Makefile Outdated Show resolved Hide resolved
client_windows.go Outdated Show resolved Hide resolved
client_windows.go Outdated Show resolved Hide resolved
exec_linux.go Outdated Show resolved Hide resolved
@@ -273,7 +272,7 @@ func runAction(clicontext *cli.Context) error {
oci.WithMounts([]specs.Mount{
{Type: "cgroup", Source: "cgroup", Destination: "/sys/fs/cgroup", Options: []string{"ro", "nosuid", "noexec", "nodev"}},
}),
oci.WithoutRunMount, // unmount default tmpfs on "/run": https://github.com/containerd/nerdctl/issues/157
WithoutRunMount(), // unmount default tmpfs on "/run": https://github.com/containerd/nerdctl/issues/157
Copy link
Member

Choose a reason for hiding this comment

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

Just if runtime.GOOS == "linux" { opts = append(opts, oci.WithoutRunMount) }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did it this way becuase oci.WithoutRunMount is in a Linux tagged file so it fails when building. 😞

@AkihiroSuda
Copy link
Member

Thanks, could you squash commits

@jsturtevant jsturtevant force-pushed the windows-part1 branch 3 times, most recently from a64bb8f to 552f67c Compare April 24, 2021 03:13
@AkihiroSuda AkihiroSuda added the platform/Windows/Non-WSL2 Microsoft Windows (non-WSL2) label Apr 24, 2021
login_windows.go Outdated Show resolved Hide resolved
Comment on lines +27 to +37
func appBashComplete(clicontext *cli.Context) {
return
}

func bashCompleteNamespaceNames(clicontext *cli.Context) {
return
}

func bashCompleteSnapshotterNames(clicontext *cli.Context) {
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to disable bash completion output on Windows builds? Or is this due to lack of Windows support in the nerdctl packages the bash-completion functions use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These functions wouldn't compile due to assumption for Linux. I didn't think that bash completion would function Windows so left them blank.

Copy link
Contributor

@TBBle TBBle Apr 27, 2021

Choose a reason for hiding this comment

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

Fair 'nuff for now. We can come back to it later, if ever. Most of my team uses bash on Window as their default shell (which surprised me when I joined them, and brings a bunch of its own issues), but without this PR, we don't have bash completion output on Windows anyway, so it's not a regression.

Copy link
Member

Choose a reason for hiding this comment

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

Most of my team uses bash on Window as their default shell

WSL bash? Cygwin bash? MinGW bash?

Copy link
Contributor

Choose a reason for hiding this comment

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

Git Bash, I believe, so Cygwin-derived via MSYS2, but has a different env-var for disabling /-path conversion.

Makefile Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@AkihiroSuda
Copy link
Member

LGTM except CI failure, thanks!

Signed-off-by: James Sturtevant <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/Windows/Non-WSL2 Microsoft Windows (non-WSL2)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants