Answers for "docker compose logs container stdout"

0

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"
Posted by: Guest on March-25-2022

Code answers related to "docker compose logs container stdout"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language