On Mon, Feb 26, 2024 at 07:19:48AM +0100, Matthias Apitz wrote:
El día viernes, febrero 23, 2024 a las 08:24:58 -0800, Robin Lee Powell via Podman escribió:
On Fri, Feb 23, 2024 at 02:43:48PM +0100, Matthias Apitz wrote:
The Dockerfile which is used to build the container end with:
$ tail -5 suse/Dockerfile EXPOSE 22 8076 3045
ENTRYPOINT /usr/local/bin/start.sh
STOPSIGNAL SIGQUIT
Any ideas what I do wrong?
matthias
Most likely the program running in start.sh is ignoreing the SIGSTOP signal.
The start.sh gets build from Dockerfile in the image:
... RUN echo "/etc/init.d/postgres start" >> /usr/local/bin/start.sh RUN echo "/usr/local/bin/initSunRise.sh" >> /usr/local/bin/start.sh RUN echo "/usr/sbin/sshd -D" >> /usr/local/bin/start.sh RUN chmod 0755 /usr/local/bin/start.sh
EXPOSE 22 8076 3045
ENTRYPOINT /usr/local/bin/start.sh
STOPSIGNAL SIGQUIT
You know, I was pretty confused by your situation until I saw that line. :)
There must be something more magic. This is inside the container:
26ef31df12f6:~ # /etc/init.d/postgres stop Stopping PostgreSQL: ok 26ef31df12f6:~ # ps ax PID TTY STAT TIME COMMAND 1 ? Ss 0:00 /bin/sh -c /usr/local/bin/start.sh 46 ? S 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups 180 ? Rs 0:00 sshd: root@pts/0 182 pts/0 Ss 0:00 -bash 217 pts/0 R+ 0:00 ps ax 26ef31df12f6:~ # cat /usr/local/bin/start.sh /etc/init.d/postgres start /usr/local/bin/initSunRise.sh /usr/sbin/sshd -D 26ef31df12f6:~ # kill -9 1
Nothing happens. The proc 1 keeps running.
That's because of https://unix.stackexchange.com/a/457650/52312 ; killing the sshd process (46 in your example) should do fine. Side comment: I don't actually recommend running sshd in containers; it tends to lead to thinking incorrectly about how to use containers and what they're for. Use `podman exec` instead. Example: rlpowell@stodi> cat Dockerfile FROM docker.io/library/debian:bullseye COPY crap.sh /tmp/crap.sh ENTRYPOINT bash /tmp/crap.sh rlpowell@stodi> docker run --rm -it bashtest In another window: rlpowell@stodi> podman exec -it charming_goldstine bash root@80d44555a09b:/# ps afux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 4 0.0 0.0 4032 3216 pts/1 Ss 06:35 0:00 bash root 341 0.0 0.0 6760 2912 pts/1 R+ 06:35 0:00 \_ ps afux root 1 0.0 0.0 2484 508 pts/0 Ss+ 06:35 0:00 /bin/sh -c bash /tmp/crap.sh root 2 0.0 0.0 3900 2684 pts/0 S+ 06:35 0:00 bash /tmp/crap.sh root 3 0.0 0.0 2396 496 pts/0 S+ 06:35 0:00 \_ sleep 9999 root@80d44555a09b:/# kill -9 1 root@80d44555a09b:/# ps afux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 4 0.0 0.0 4032 3216 pts/1 Ss 06:35 0:00 bash root 342 0.0 0.0 6760 2864 pts/1 R+ 06:35 0:00 \_ ps afux root 1 0.0 0.0 2484 508 pts/0 Ss+ 06:35 0:00 /bin/sh -c bash /tmp/crap.sh root 2 0.0 0.0 3900 2684 pts/0 S+ 06:35 0:00 bash /tmp/crap.sh root 3 0.0 0.0 2396 496 pts/0 S+ 06:35 0:00 \_ sleep 9999 root@80d44555a09b:/# kill -9 3 root@80d44555a09b:/# % rlpowell@stodi>