Docker Compose Logs Container Stdout

init-app.sh:

#!/usr/bin/env sh

# Exit script immediately if a command exits with a non-zero status.
set -e

# Install and configure app
[...]

# Start app
exec ./app
The above configuration works, but outputs only to stdout.

Modification #1 (last line of init script):

# Start app and log output to file
exec ./app >> "/app/log.txt" 2>&1
This configuration works also, logging the output to a file, but not to stdout.

Modification #2 (last line of init script):

# Start app and log output to both a file and stdout
exec ./app 2>&1 | tee -a "/app/log.txt"
DreamCoder