engine: add note on logging with supervisord

Added a `supervisord.conf` snippet to enable logging of stdout and
stderr for multiple processes running in a single container with
supervisord.

Signed-off-by: David Karlsson <david.karlsson@docker.com>
This commit is contained in:
David Karlsson 2023-05-11 20:07:08 +02:00
parent a2d22f16e6
commit ea2d370583
1 changed files with 23 additions and 4 deletions

View File

@ -107,10 +107,14 @@ Use a process manager like `supervisord`. This is a moderately heavy-weight
approach that requires you to package `supervisord` and its configuration in
your image (or base your image on one that includes `supervisord`), along with
the different applications it manages. Then you start `supervisord`, which
manages your processes for you. Here is an example Dockerfile using this
approach, that assumes the pre-written `supervisord.conf`, `my_first_process`,
and `my_second_process` files all exist in the same directory as your
Dockerfile.
manages your processes for you.
The following Dockerfile example shows this approach. The example assumes that
these files exist at the root of the build context:
- `supervisord.conf`
- `my_first_process`
- `my_second_process`
```dockerfile
# syntax=docker/dockerfile:1
@ -122,3 +126,18 @@ COPY my_first_process my_first_process
COPY my_second_process my_second_process
CMD ["/usr/bin/supervisord"]
```
If you want to make sure both processes output their `stdout` and `stderr` to
the container logs, you can add the following to the `supervisord.conf` file:
```ini
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
[program:app]
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
```