mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
infra container: replace pause with catatonit
Podman has been using catatonit for a number of years already. Thanks to @giuseppe, catatonit is now able to run as a pause process which allows us to replace the pause binary entirely. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -58,6 +58,7 @@ BuildRequires: libselinux-devel
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: make
|
||||
BuildRequires: systemd-devel
|
||||
Requires: catatonit >= 0.1.7
|
||||
Requires: containers-common
|
||||
Requires: conmon
|
||||
Requires: containernetworking-plugins >= 0.6.0-3
|
||||
|
@ -29,19 +29,16 @@ func buildPauseImage(rt *libpod.Runtime, rtConfig *config.Config) (string, error
|
||||
return imageName, nil
|
||||
}
|
||||
|
||||
// NOTE: Having the pause binary in its own directory keeps the door
|
||||
// open for replacing the image building with using an overlay root FS.
|
||||
// The latter turned out to be complex and error prone (see #11956) but
|
||||
// we may be able to come up with a proper solution at a later point in
|
||||
// time.
|
||||
pausePath, err := rtConfig.FindHelperBinary("pause/pause", false)
|
||||
// Also look into the path as some distributions install catatonit in
|
||||
// /usr/bin.
|
||||
catatonitPath, err := rtConfig.FindHelperBinary("catatonit", true)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("finding pause binary: %w", err)
|
||||
}
|
||||
|
||||
buildContent := fmt.Sprintf(`FROM scratch
|
||||
COPY %s /pause
|
||||
ENTRYPOINT ["/pause"]`, pausePath)
|
||||
COPY %s /catatonit
|
||||
ENTRYPOINT ["/catatonit", "-P"]`, catatonitPath)
|
||||
|
||||
tmpF, err := ioutil.TempFile("", "pause.containerfile")
|
||||
if err != nil {
|
||||
|
@ -110,11 +110,11 @@ t GET libpod/pods/fakename/top 404 \
|
||||
.cause="no such pod"
|
||||
|
||||
t GET libpod/pods/foo/top 200 \
|
||||
.Processes[0][-1]="/pause" \
|
||||
.Processes[0][-1]="/catatonit -P" \
|
||||
.Titles[-1]="COMMAND"
|
||||
|
||||
t GET libpod/pods/foo/top?ps_args=args,pid 200 \
|
||||
.Processes[0][0]="/pause" \
|
||||
.Processes[0][0]="/catatonit -P" \
|
||||
.Processes[0][1]="1" \
|
||||
.Titles[0]="COMMAND" \
|
||||
.Titles[1]="PID" \
|
||||
|
@ -369,13 +369,13 @@ var _ = Describe("Podman pod create", func() {
|
||||
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
|
||||
check1.WaitWithDefaultTimeout()
|
||||
Expect(check1).Should(Exit(0))
|
||||
Expect(check1.OutputToString()).To(Equal("/pause"))
|
||||
Expect(check1.OutputToString()).To(Equal("/catatonit -P"))
|
||||
|
||||
// check the Path and Args
|
||||
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
|
||||
check2.WaitWithDefaultTimeout()
|
||||
Expect(check2).Should(Exit(0))
|
||||
Expect(check2.OutputToString()).To(Equal("/pause:[/pause]"))
|
||||
Expect(check2.OutputToString()).To(Equal("/catatonit:[-P]"))
|
||||
})
|
||||
|
||||
It("podman create pod with --infra-command", func() {
|
||||
|
Reference in New Issue
Block a user