mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +08:00
Fix --init and --init-path
Init properly passed into specgen Allow --init with --systemd=true but not --systemd=always. Signed-off-by: Joseph Gooch <mrwizard@dok.org>
This commit is contained in:
@ -112,7 +112,7 @@ func makeCommand(ctx context.Context, s *specgen.SpecGenerator, img *image.Image
|
||||
if initPath == "" {
|
||||
return nil, errors.Errorf("no path to init binary found but container requested an init")
|
||||
}
|
||||
finalCommand = append([]string{initPath, "--"}, finalCommand...)
|
||||
finalCommand = append([]string{"/dev/init", "--"}, finalCommand...)
|
||||
}
|
||||
|
||||
return finalCommand, nil
|
||||
|
@ -314,8 +314,8 @@ func addContainerInitBinary(s *specgen.SpecGenerator, path string) (spec.Mount,
|
||||
if !s.PidNS.IsPrivate() {
|
||||
return mount, fmt.Errorf("cannot add init binary as PID 1 (PID namespace isn't private)")
|
||||
}
|
||||
if s.Systemd == "true" || s.Systemd == "always" {
|
||||
return mount, fmt.Errorf("cannot use container-init binary with systemd")
|
||||
if s.Systemd == "always" {
|
||||
return mount, fmt.Errorf("cannot use container-init binary with systemd=always")
|
||||
}
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
return mount, errors.Wrap(err, "container-init binary not found on the host")
|
||||
|
Reference in New Issue
Block a user