Skip to content

Commit

Permalink
fix(base-ssh,ssh-ubuntu): use tini for zombie reaping and signal hand…
Browse files Browse the repository at this point in the history
…ling (akash-network#565)

Use tini as an init system to manage orphaned child processes, ensuring they
don't become zombie (defunct) processes by reaping (cleaning up) them when
their parent process doesn't.

Tini will also correctly handle signals like SIGTERM (15), allowing child
processes to terminate gracefully within the allotted time, rather than
being forcefully killed with SIGKILL after a 15-second timeout.
  • Loading branch information
andy108369 committed Aug 22, 2024
1 parent 86e5ab0 commit 4b9e4a3
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
12 changes: 10 additions & 2 deletions base-ssh/Dockerfile.centos
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ RUN dnf -y update && \
COPY ssh-entrypoint.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh

ENTRYPOINT ["/usr/local/bin/init.sh"]
# Use tini as an init system to manage orphaned child processes, ensuring they
# don't become zombie (defunct) processes by reaping (cleaning up) them when
# their parent process doesn't.
# Tini will also correctly handle signals like SIGTERM (15), allowing child
# processes to terminate gracefully within the allotted time, rather than
# being forcefully killed with SIGKILL after a 15-second timeout.
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--", "/usr/local/bin/init.sh"]

CMD ["tail", "-f", "/dev/null"]

EXPOSE 22
EXPOSE 22
12 changes: 10 additions & 2 deletions base-ssh/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ RUN apt-get update; \
COPY ssh-entrypoint.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh

ENTRYPOINT ["/usr/local/bin/init.sh"]
# Use tini as an init system to manage orphaned child processes, ensuring they
# don't become zombie (defunct) processes by reaping (cleaning up) them when
# their parent process doesn't.
# Tini will also correctly handle signals like SIGTERM (15), allowing child
# processes to terminate gracefully within the allotted time, rather than
# being forcefully killed with SIGKILL after a 15-second timeout.
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--", "/usr/local/bin/init.sh"]

CMD ["tail", "-f", "/dev/null"]

EXPOSE 22
EXPOSE 22
12 changes: 10 additions & 2 deletions base-ssh/Dockerfile.suse
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ RUN mkdir -p /run/sshd && \
COPY ssh-entrypoint.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh

ENTRYPOINT ["/usr/local/bin/init.sh"]
# Use tini as an init system to manage orphaned child processes, ensuring they
# don't become zombie (defunct) processes by reaping (cleaning up) them when
# their parent process doesn't.
# Tini will also correctly handle signals like SIGTERM (15), allowing child
# processes to terminate gracefully within the allotted time, rather than
# being forcefully killed with SIGKILL after a 15-second timeout.
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--", "/usr/local/bin/init.sh"]

CMD ["tail", "-f", "/dev/null"]

EXPOSE 22
EXPOSE 22
12 changes: 10 additions & 2 deletions base-ssh/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ RUN apt-get update; \
COPY ssh-entrypoint.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh

ENTRYPOINT ["/usr/local/bin/init.sh"]
# Use tini as an init system to manage orphaned child processes, ensuring they
# don't become zombie (defunct) processes by reaping (cleaning up) them when
# their parent process doesn't.
# Tini will also correctly handle signals like SIGTERM (15), allowing child
# processes to terminate gracefully within the allotted time, rather than
# being forcefully killed with SIGKILL after a 15-second timeout.
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--", "/usr/local/bin/init.sh"]

CMD ["tail", "-f", "/dev/null"]

EXPOSE 22
EXPOSE 22
12 changes: 10 additions & 2 deletions ssh-ubuntu/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ RUN apt-get update; \
COPY ssh-entrypoint.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh

ENTRYPOINT ["/usr/local/bin/init.sh"]
# Use tini as an init system to manage orphaned child processes, ensuring they
# don't become zombie (defunct) processes by reaping (cleaning up) them when
# their parent process doesn't.
# Tini will also correctly handle signals like SIGTERM (15), allowing child
# processes to terminate gracefully within the allotted time, rather than
# being forcefully killed with SIGKILL after a 15-second timeout.
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--", "/usr/local/bin/init.sh"]

CMD ["tail", "-f", "/dev/null"]

EXPOSE 22
EXPOSE 22

0 comments on commit 4b9e4a3

Please sign in to comment.