extend tshwrapper with socat

This commit is contained in:
Nico Schottelius 2023-09-11 16:10:01 +02:00
parent b980773d4c
commit a69ee48f13

View file

@ -1,11 +1,26 @@
#!/bin/sh
docker run -ti \
--entrypoint /usr/local/bin/tsh \
-v ~/.tsh:/root/.tsh \
-p 3155:3155 \
public.ecr.aws/gravitational/teleport:13 \
"$@"
set -x
if ! docker ps | grep -q tshwrapper ; then
docker run -d --init \
--entrypoint /usr/bin/sleep \
--name tshwrapper \
-v ~/.tsh:/root/.tsh \
-p 3155:3155 \
public.ecr.aws/gravitational/teleport:13 infinity
docker exec -ti tshwrapper /bin/sh -c "apt-get update && apt-get -y install socat supervisor"
docker exec -ti tshwrapper /bin/sh -c "echo '[program:socat]' > /etc/supervisor/conf.d/socat.conf"
docker exec -ti tshwrapper /bin/sh -c "echo 'command=/usr/bin/socat tcp-listen:3155 tcp:localhost:3166' >> /etc/supervisor/conf.d/socat.conf"
docker exec -ti tshwrapper /bin/sh -c "supervisord -c /etc/supervisor/supervisord.conf"
fi
docker exec -ti tshwrapper "$@"
exit 0
# public.ecr.aws/gravitational/teleport-distroless:13 \
docker exec -ti tshwrapper "/bin/sh" -c "echo '(while true; do socat tcp-listen:3155 tcp:localhost:3166; done) &' > /socat.sh"
[program:socat]
command=/usr/bin/socat tcp-listen:3155 tcp:localhost:3166