Skip to content

Commit

Permalink
Retain pause.exe as entrypoint for default pause images
Browse files Browse the repository at this point in the history
Signed-off-by: Kirtana Ashok <[email protected]>
  • Loading branch information
Kirtana Ashok authored and Kirtana Ashok committed Jan 17, 2023
1 parent d6dd825 commit f9b6b73
Showing 1 changed file with 14 additions and 3 deletions.
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 @@ -7,6 +7,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"sync"

"github.com/Microsoft/hcsshim/internal/log"
Expand Down Expand Up @@ -238,10 +239,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

0 comments on commit f9b6b73

Please sign in to comment.