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
Allow switching Windows runtimes. #42089
Conversation
Looks that finding runtime binaries with this logic fails to error:
Way how I set it on #41479 works. Which is enabling experimental mode + DOCKER_WINDOWS_CONTAINERD_RUNTIME which are called on: moby/pkg/system/init_windows.go Lines 15 to 29 in 46cdcd2
and setting containerd runtime name on: Line 15 in 46cdcd2
|
Closing this one as I think the work @olljanat is exactly the right way to handle this. |
Actually, I take that back. There's some other work I'd like to do (namely embed containerd instead of relying on an external one when no --containerd= is set) that needs this work. |
d6277dd
to
81fb2be
Compare
81fb2be
to
1a72df5
Compare
RS5 failures look unrelated. |
54ebe0b
to
e1a1bf3
Compare
|
||
rt := daemon.configStore.GetDefaultRuntimeName() | ||
if rt == "" { | ||
if daemon.configStore.ContainerdAddr == "" { |
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.
No cases where we use a default value for the containerd address or anything like that? ISTR some talk about trying to default to V2 on 2022+? (I guess that ship sailed?)
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.
So my plan is to follow-up with a PR to embed containerd and use that if no address is specified on both linux and windows.
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.
That said, even on Linux we don't default a socket here.
On Windows we just don't start a containerd process like we do on Linux.
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.
Ahhh, got it; thanks for the added detail.
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.
Looks pretty straightforward to me 😇
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.
LGTM
// This is used by the `default-runtime` flag in dockerd as the default value. | ||
// On windows we'd prefer to keep this empty so the value is auto-detected based on other options. | ||
StockRuntimeName = "" |
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 whole StockRuntimeName
vs DefaultRuntimeName
is a bit confusing.
Wondering, will setting this to an empty string cause some odd behavior if somehow the option is set to an empty string?
Lines 44 to 46 in 7b9275c
if parts[0] == o.stockRuntimeName { | |
return fmt.Errorf("runtime name '%s' is reserved", o.stockRuntimeName) | |
} |
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.
Ah, never mind; looks like we first check if it's not empty;
Lines 39 to 41 in 7b9275c
if parts[0] == "" || parts[1] == "" { | |
return fmt.Errorf("invalid runtime argument: %s", val) | |
} |
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.
oh! looks like CI is failing; looks relevant;
ERRO Running error: buildssa: analysis skipped: errors in package: [/go/src/github.com/docker/docker/daemon/config/config_linux_test.go:153:5: unknown field DefaultRuntime in struct literal]
Could you also open a PR in the CLI repository to update the |
This should fix the failure; diff --git a/daemon/config/config_linux_test.go b/daemon/config/config_linux_test.go
index 424bfc00e6..cfc635567d 100644
--- a/daemon/config/config_linux_test.go
+++ b/daemon/config/config_linux_test.go
@@ -150,7 +150,9 @@ func TestUnixValidateConfigurationErrors(t *testing.T) {
Runtimes: map[string]types.Runtime{
"foo": {},
},
- DefaultRuntime: "bar",
+ CommonConfig: CommonConfig{
+ DefaultRuntime: "bar",
+ },
},
},
} |
This adds support for 2 runtimes on Windows, one that uses the built-in HCSv1 integration and another which uses containerd with the runhcs shim. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
e1a1bf3
to
7ccf750
Compare
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.
LGTM (assuming green)
This adds support for 2 runtimes on Windows, one that uses the built-in
HCSv1 integration and another which uses containerd with the runhcs
shim.
Related to #41455