Skip to content

Commit

Permalink
remove finish script avoiding s6 nuke (#1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charly Fontaine authored and xvello committed Feb 23, 2018
1 parent 653486c commit bd37139
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dockerfiles/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ COPY s6-services /etc/services.d/
COPY entrypoint /etc/cont-init.d/
COPY probe.sh initlog.sh /

# Override the exit script by ours to fix --pid=host operations
COPY init-stage3 /etc/s6/init/init-stage3

# Prepare for running without root
RUN adduser --group dd-agent \
&& adduser --system --no-create-home --disabled-password --ingroup dd-agent dd-agent \
Expand Down
14 changes: 14 additions & 0 deletions Dockerfiles/agent/init-stage3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/execlineb -S0

# This is the shutdown script, running as process 1.
cd /

# Merge environments from our custom stage into current context
s6-envdir -I /var/run/s6/env-stage3

# Reap all the zombies, and we're done.
wait { }

# Use CMD exit code defaulting to zero if not present.
importas -u -D0 S6_STAGE2_EXITED S6_STAGE2_EXITED
exit ${S6_STAGE2_EXITED}
4 changes: 3 additions & 1 deletion Dockerfiles/agent/s6-services/agent/finish
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
# Kill the container if the main agent were to exit

foreground { /initlog.sh "AGENT EXITED WITH CODE ${1}, SIGNAL ${2}, KILLING CONTAINER" }
s6-svscanctl -t /var/run/s6/services

# If the container is stopped via docker, s6 is already closing, silencing the error
redirfd -w 2 /dev/null s6-svscanctl -t /var/run/s6/services
5 changes: 5 additions & 0 deletions releasenotes/notes/dockerfile-pid-host-47ddbf2cdfa6e02e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Fix Docker container `--pid=host` operations. Previous RCs can cause host system
instabilities and should not be run in pid host mode.

0 comments on commit bd37139

Please sign in to comment.