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

[release/0.9] Retain pause.exe as entrypoint for default pause images #1634

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions cmd/containerd-shim-runhcs-v1/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"sync"

"github.com/Microsoft/hcsshim/internal/log"
Expand Down Expand Up @@ -228,10 +229,20 @@ func createPod(ctx context.Context, events publisher, req *task.CreateTaskReques
}
} else {
if isWCOW {
// The pause container activation will immediately exit on Windows
defaultArgs := "c:\\windows\\system32\\cmd.exe"
// For the default pause image, the entrypoint
// used is pause.exe
// If the default pause image is not used for pause containers,
// the activation will immediately exit on Windows
// because there is no command. We forcibly update the command here
// to keep it alive.
s.Process.CommandLine = "cmd /c ping -t 127.0.0.1 > nul"
// to keep it alive only for non-default pause images.
// TODO: This override can be completely removed from containerd/1.7
if (len(s.Process.Args) == 1 && strings.EqualFold(s.Process.Args[0], defaultArgs)) ||
strings.EqualFold(s.Process.CommandLine, defaultArgs) {
log.G(ctx).Warning("Detected CMD override for pause container entrypoint." +
"Please consider switching to a pause image with an explicit cmd set")
s.Process.CommandLine = "cmd /c ping -t 127.0.0.1 > nul"
}
}
// LCOW (and WCOW Process Isolated for the time being) requires a real
// task for the sandbox.
Expand Down