-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Description
Discussed in #10380
Originally posted by TinaMor June 24, 2024
Windows requires that stderr is an empty string when running a container with TTY. In Containerd, pkg/cio/io.go#L298-L302, the Stderr is set to a value, e.g.
res = "binary:///C:/_xxx_/nerdctl.exe?_NERDCTL_INTERNAL_LOGGING=C%3A%5CProgramData%5Cnerdctl%5C052055e3"which causes microsoft/hcsshim service_internal.go#L127 to fail to create a new task.
Lines 298 to 302 in 4a18adc
| config: Config{ | |
| Stdout: res, | |
| Stderr: res, | |
| Terminal: true, | |
| }, |
To address this issue related to nerdctl, we can refactor the TerminalLogURI() function. This will involve adding an optional parameter that specifies whether stderr should be set to an empty string when the terminal is used. This change will help avoid the "failed precondition" error when creating a new task on Windows.
Example:
func TerminalLogURI(uri *url.URL, setStderr ...bool) Creator {
return func(_ string) (IO, error) {
// Default value for Stderr is an ampty string
stderr := ""
if len(setStderr) > 0 && setStderr[0] {
stderr = uri.String()
}
return &logURI{
config: Config{
Stdout: uri.String(),
Stderr: stderr,
Terminal: true,
},
}, nil
}
}Related issues:
nerdctl bug #2966
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels