这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
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: 2 additions & 1 deletion dokku
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ case "$1" in

# if we can't post-deploy successfully, kill new container
kill_new() {
docker inspect $id &> /dev/null && docker kill $id > /dev/null
docker inspect $id &> /dev/null && docker stop $id > /dev/null && docker kill $id > /dev/null
trap - INT TERM EXIT
kill -9 $$
}
Expand Down Expand Up @@ -120,6 +120,7 @@ case "$1" in
exec >/dev/null 2>/dev/null </dev/null
trap '' INT HUP
sleep $WAIT
docker stop $oldid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice this does not work consistently. See the open PR for scaling. #1118

Instead I think we want to attempt stop (default timeout is 10 sec) then kill.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelshobbs make sense. So:

docker stop $oldid
sleep $WAIT_FOR_KILL
docker kill $oldid

or just

docker stop $oldid
docker kill $oldid

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the second one.

From https://docs.docker.com/reference/commandline/cli/#stop

Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]

Stop a running container by sending SIGTERM and then SIGKILL after a
grace period

  -t, --time=10      Seconds to wait for stop before killing it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelshobbs updated

docker kill $oldid
) & disown -a
# Use trap since disown/nohup don't seem to keep child alive
Expand Down