Closed goochjj closed 4 years ago
Yes the --init flag should be substituting for the entrypoint, I believe.
Maybe relevant lines: https://github.com/containers/libpod/blob/1f05606fac7e5835cd76ef407a64597df3251aae/cmd/podman/common/specgen.go#L569-L572
Note there appears to be proper implementation in pkg/specgen/generate/. Two parts, storage (bind mount) and the command modification.
I'm unclear of the relation between pkg/specgen and cmd/podman/common/specgen so I'm not sure how these interact, if at all.
I'll take this next.
@mheon PTAL #6622
Notes 1) I'm not sure why the TODO is in the specgen area - re: not in the spec, seems someone at some point wasn't sure this was as straightforward as it seemed. 2) It'd be nice to have an --init-arg option (repeatable) i.e. catatonit can accept a -g option, and tini has options too... 3) Using init seems to require an explicit --systemd false - which is different from Docker (but docker doesn't do systemd-specific behavior on start, sooo)... I did comment out the check and it runs fine with both options specified, based on my very limited anecdotal evidence. I'm guessing it's just overkill to mount the cgroups and tmpfs sockets and journal tmpfs etc etc etc... In which case I'm not sure if the right option might be that --init turns off the systemd default of true, or if it just needs to be documented that if you're using --init you need to do --systemd false too... For further discussion
On the systemd thing - I think we should change init to work with systemd=true
as well as --systemd=false
... We still want always
to error (that has to be explicitly set) but systemd=true
is not necessarily a conflict.
AYW done
AYW? As You Will?
As You Wish
Princess Bride :-P
Fixed landed, thanks @goochjj
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
--init does not appear to do anything.
Steps to reproduce the issue:
podman run --rm -it alpine ps awwux PID USER TIME COMMAND 1 root 0:00 ps awwux
podman run --rm -it --init alpine ps awwux PID USER TIME COMMAND 1 root 0:00 ps awwux
(note, no init. /proc/1/exe is ps)
podman run --rm -it -v /opt/podman/libexec/podman/catatonit:/dev/init --entrypoint /dev/init alpine ps awwux PID USER TIME COMMAND 1 root 0:00 /dev/init ps awwux 6 root 0:00 ps awwux
Done manually obvi works.
Other evidence: podman run --rm -it --init alpine -h Error: container_linux.go:353: starting container process caused: exec: "-h": executable file not found in $PATH: OCI runtime command not found error
docker run --rm -it --init alpine -h [FATAL tini (7)] exec -h failed: No such file or directory
If cataonit were executed it would look like this: /opt/podman/libexec/podman/catatonit -- -h ERROR (catatonit:26818): failed to exec pid1: No such file or directory
Additional information you deem important (e.g. issue happens only occasionally):
Looking at the code, Init: and InitPath: are never used in ./cmd/podman/shared/create.go (v1.9.3) or ./cmd/podman/common/create.go (master)
I see bits in pkg/specgen/generate/oci.go... but the config.json shows io.podman.annotations.init FALSE
In addition, the unit tests verify that podman runs with --init and --init --init-path, but never actually verifies that a bind mount takes place, or the init process was actually spawned. (i.e. use podman inspect to find the bind mount, use podman top to verify there's a pid 1 w/ init in it and another pid with the command)
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):None - compiled from source.