Skip to content

Commit 9b6bc8c

Browse files
committed
build: use exec form for flask example
shell form doesnt trap sigint Signed-off-by: David Karlsson <[email protected]>
1 parent 9833685 commit 9b6bc8c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

content/build/building/packaging.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ COPY hello.py /
9292
# final configuration
9393
ENV FLASK_APP=hello
9494
EXPOSE 8000
95-
CMD flask run --host 0.0.0.0 --port 8000
95+
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]
9696
```
9797

9898
Here's a breakdown of what this Dockerfile does:
@@ -234,12 +234,22 @@ team members understand what this application is doing.
234234
Finally, [`CMD` instruction](../../engine/reference/builder.md#cmd) sets the
235235
command that is run when the user starts a container based on this image.
236236

237+
```dockerfile
238+
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]
239+
```
240+
241+
This command starts the flask development server listening on all addresses
242+
on port `8000`. The example here uses the "exec form" version of `CMD`.
243+
It's also possible to use the "shell form":
244+
237245
```dockerfile
238246
CMD flask run --host 0.0.0.0 --port 8000
239247
```
240248

241-
In this case we'll start the flask development server listening on all addresses
242-
on port `8000`.
249+
There are subtle differences between these two versions,
250+
for example in how they trap signals like `SIGTERM` and `SIGKILL`.
251+
For more information about these differences, see
252+
[Shell and exec form](../../engine/reference/builder.md#shell-and-exec-form)
243253

244254
## Building
245255

0 commit comments

Comments
 (0)