Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker] override s6-overlay stage3 script avoiding s6 nuke #1337

Merged
merged 1 commit into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.