From 9b6bc8cd4622726b829a307b43956e7075a1ca48 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:41:00 +0100 Subject: [PATCH] build: use exec form for flask example shell form doesnt trap sigint Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- content/build/building/packaging.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/content/build/building/packaging.md b/content/build/building/packaging.md index 310751bc7e..ec3e80a495 100644 --- a/content/build/building/packaging.md +++ b/content/build/building/packaging.md @@ -92,7 +92,7 @@ COPY hello.py / # final configuration ENV FLASK_APP=hello EXPOSE 8000 -CMD flask run --host 0.0.0.0 --port 8000 +CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"] ``` Here's a breakdown of what this Dockerfile does: @@ -234,12 +234,22 @@ team members understand what this application is doing. Finally, [`CMD` instruction](../../engine/reference/builder.md#cmd) sets the command that is run when the user starts a container based on this image. +```dockerfile +CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"] +``` + +This command starts the flask development server listening on all addresses +on port `8000`. The example here uses the "exec form" version of `CMD`. +It's also possible to use the "shell form": + ```dockerfile CMD flask run --host 0.0.0.0 --port 8000 ``` -In this case we'll start the flask development server listening on all addresses -on port `8000`. +There are subtle differences between these two versions, +for example in how they trap signals like `SIGTERM` and `SIGKILL`. +For more information about these differences, see +[Shell and exec form](../../engine/reference/builder.md#shell-and-exec-form) ## Building