“Как перенаправить Docker-Compose Command Stdout Stderr из Docker Container в файл” Ответ

Как перенаправить Docker-Compose Command Stdout Stderr из Docker Container в файл

# start-cluster.sh
exec node cluster.js >> /var/log/cluster/console.log 2>&1
And in docker-compose file:

# docker-compose.yml
command: bash -c "./start-cluster.sh"
Starting the cluster with exec replaces the shell with node process and this way it has always PID=1 and my logs are output to file.
DreamCoder

Как перенаправить Docker-Compose Command Stdout Stderr из Docker Container в файл

#!/bin/sh

# redirect stdout and stderr to files
exec >/tmp/stdout.log
exec 2>/tmp/stderr.log

# now run the requested CMD without forking a subprocess
exec "$@"
DreamCoder

Ответы похожие на “Как перенаправить Docker-Compose Command Stdout Stderr из Docker Container в файл”

Вопросы похожие на “Как перенаправить Docker-Compose Command Stdout Stderr из Docker Container в файл”

Больше похожих ответов на “Как перенаправить Docker-Compose Command Stdout Stderr из Docker Container в файл” по Shell/Bash

Смотреть популярные ответы по языку

Смотреть другие языки программирования