From 5b5dafde0d627819df62bc47d54858afa68902ae Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 22 Mar 2019 19:29:18 -0700 Subject: [PATCH] hack: make tmux optional for shell Signed-off-by: Tonis Tiigi --- hack/demo-env/entrypoint.sh | 17 +++++++++++++---- hack/shell | 6 ++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/hack/demo-env/entrypoint.sh b/hack/demo-env/entrypoint.sh index e2effa50..e4714bea 100755 --- a/hack/demo-env/entrypoint.sh +++ b/hack/demo-env/entrypoint.sh @@ -1,8 +1,17 @@ #!/bin/sh -tmux new -s demo -d -tmux new-window 'dockerd -s overlay2 -D' -tmux new-window -tmux a -t demo +dockerdCmd="dockerd -s overlay2 -D" + +if [ -n "$TMUX_ENTRYPOINT" ]; then + tmux new -s demo -d + tmux new-window "$dockerdCmd" + tmux new-window + tmux a -t demo +else + ( $dockerdCmd 2>/var/log/dockerd.log & ) + exec sh +fi + + diff --git a/hack/shell b/hack/shell index 5fcd0bfa..95cba7d5 100755 --- a/hack/shell +++ b/hack/shell @@ -2,11 +2,13 @@ set -e +: ${TMUX=} + function clean { docker rmi $(cat $iidfile) } iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX) -docker build --iidfile $iidfile --target demo-env . +DOCKER_BUILDKIT=1 docker build --iidfile $iidfile --target demo-env . trap clean EXIT -docker run -it --privileged --rm $(cat $iidfile) \ No newline at end of file +docker run -it --privileged --rm -e TMUX_ENTRYPOINT=$TMUX $(cat $iidfile) \ No newline at end of file