Skip to content

Commit

Permalink
Allow docker logs to grab container output, too #254
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Jun 7, 2020
1 parent f884871 commit 347adce
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Run 'x11docker --help' or scroll down to read usage information.
# More documentation at: https://github.com/mviereck/x11docker

Version="6.6.2"
Version="6.6.3-beta"

# --enforce-i: Enforce running in interactive mode to allow commands tty and weston-launch in special setups.
grep -q -- "--enforce-i" <<< "$*" && case $- in
Expand Down Expand Up @@ -3865,7 +3865,8 @@ check_containerhome() { # options --home, --homedir, --homebasedir: chec
}
;;
no)
Containeruserhomebasefolder="/home.tmp"
# Containeruserhomebasefolder="/home.tmp"
Containeruserhomebasefolder="/home"
;;
volume)
Containeruserhomebasefolder="/home.volume/$Persistanthomevolume"
Expand Down Expand Up @@ -5597,8 +5598,8 @@ create_dockerrc() { ### create dockerrc: This script runs as root (o
echo " echo ''"


echo " echo 'exec 6>&1 7>&2'"
echo " echo 'exec >>$(convertpath share $Containerlogfile) 2>&1'"
# echo " echo 'exec 6>&1 7>&2'"
# echo " echo 'exec >>$(convertpath share $Containerlogfile) 2>&1'"
echo " echo ''"

echo " echo '$(declare -f mysleep)'"
Expand Down Expand Up @@ -5771,10 +5772,11 @@ create_dockerrc() { ### create dockerrc: This script runs as root (o
\\\"\""
echo " echo ''"

echo " echo 'exec 1>&6 2>&7 6>&- 7>&-'"
# echo " echo 'exec 1>&6 2>&7 6>&- 7>&-'"
case $Interactive in
no)
echo " echo \"\$Exec \\\$Dbus \$Entrypoint \$Containercommand $( [ "$Forwardstdin" = "yes" ] && echo "<$(convertpath share $Cmdstdinfifo)") >>$(convertpath share $Cmdstdoutlogfile) 2>>$(convertpath share $Cmdstderrlogfile)\""
# echo " echo \"\$Exec \\\$Dbus \$Entrypoint \$Containercommand $( [ "$Forwardstdin" = "yes" ] && echo "<$(convertpath share $Cmdstdinfifo)") >>$(convertpath share $Cmdstdoutlogfile) 2>>$(convertpath share $Cmdstderrlogfile)\""
echo " echo \"\$Exec \\\$Dbus \$Entrypoint \$Containercommand $( [ "$Forwardstdin" = "yes" ] && echo "<$(convertpath share $Cmdstdinfifo)") \""
;;
yes)
echo " echo 'exec >/dev/stdout 2>/dev/stderr'"
Expand Down Expand Up @@ -5894,7 +5896,8 @@ $Wmdockercommand"'
echo "#### run docker image ####"
case $Interactive in
no)
echo "read Containerid < <($Dockercommand 2>>$Containerlogfile | rmcr)"
# echo "read Containerid < <($Dockercommand 2>>$Containerlogfile | rmcr)"
echo "read Containerid < <($Dockercommand | rmcr)"
;;
yes)
[ "$Winpty" ] && echo "$Winpty bash $Dockercommandfile <&0 &" || echo "$Dockercommand <&0 &"
Expand All @@ -5921,12 +5924,14 @@ $Wmdockercommand"'
echo "done"
echo ""

[ "$Switchcontaineruser" = "yes" ] && {
echo "$Dockerexe logs -f \$Containerid >> $Containerlogfile 2>&1 &"
#[ "$Switchcontaineruser" = "yes" ] && {
# echo "$Dockerexe logs -f \$Containerid >> $Containerlogfile 2>&1 &"
echo "# Store container output separated for stdout and stderr"
echo "$Dockerexe logs -f \$Containerid 1>>$Cmdstdoutlogfile 2>>$Cmdstderrlogfile &"
echo "Dockerlogspid=\$!"
echo "storepid \$Dockerlogspid dockerlogs"
echo ""
}
#}

echo "# Wait for pid 1 in container"
echo "for ((Count=1 ; Count<=40 ; Count++)); do"
Expand Down

0 comments on commit 347adce

Please sign in to comment.