Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

How to redirect docker-compose command stdout stderr from docker container to file

#!/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 "$@"
Comment

How to redirect docker-compose command stdout stderr from docker container to file

# 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.
Comment

PREVIOUS NEXT
Code Example
Shell :: What does mv: cannot stat not_here: No such file or directory mean in Ubuntu 20.04? 
Shell :: screenshot avec annotation linux 
Shell :: Install Chrome Linux Red Hat 
Shell :: how to change line in slack 
Shell :: parse json logs in loki, promtail 
Shell :: powershell invert 
Shell :: enable ctrl alt backspace 
Shell :: Inspecting commands 
Shell :: git config --global user.email "you@example.com" 
Shell :: install Dirichlet Multinomial R package 
Shell :: conda install nose2 
Shell :: Command to get list of shell variables with less length in bash 
Shell :: hide active app from dock 
Shell :: Navigate to previous directory in windows command prompt 
Shell :: linux change default gateway 
Shell :: how to uninstall in ubuntu 
Shell :: umount device is busy 
Shell :: vagrant download 
Shell :: apt-get install plex 
Shell :: dlib installation 
Shell :: shortcut key for screenshot in windows 7 
Shell :: bokeh install 
Shell :: clone docker image 
Shell :: how to send email with body and attachment in unix 
Shell :: twisted.internet.error.ReactorAlreadyInstalledError: reactor already installed [5804] Failed to execute script main 
Shell :: loggy.sh android 
Shell :: install react router 
Php :: php string to uppwe 
Php :: wp cron disable 
Php :: laravel return back with success 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =