mirror of https://github.com/docker/docs.git
build: use exec form for flask example
shell form doesnt trap sigint Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
983368516f
commit
9b6bc8cd46
|
@ -92,7 +92,7 @@ COPY hello.py /
|
||||||
# final configuration
|
# final configuration
|
||||||
ENV FLASK_APP=hello
|
ENV FLASK_APP=hello
|
||||||
EXPOSE 8000
|
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:
|
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
|
Finally, [`CMD` instruction](../../engine/reference/builder.md#cmd) sets the
|
||||||
command that is run when the user starts a container based on this image.
|
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
|
```dockerfile
|
||||||
CMD flask run --host 0.0.0.0 --port 8000
|
CMD flask run --host 0.0.0.0 --port 8000
|
||||||
```
|
```
|
||||||
|
|
||||||
In this case we'll start the flask development server listening on all addresses
|
There are subtle differences between these two versions,
|
||||||
on port `8000`.
|
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
|
## Building
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue