From 54474165a63b44af39f0e13462a4399cce94f9ea Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Mon, 2 Dec 2024 18:29:57 +0100 Subject: [PATCH] container: to easily access the running container Just to avoid doing a 'docker ps' and 'docker exec' manually. Signed-off-by: Matthieu Baerts (NGI0) --- connect.sh | 7 +++---- container.sh | 7 +++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100755 container.sh diff --git a/connect.sh b/connect.sh index feb5d27..9558f6c 100755 --- a/connect.sh +++ b/connect.sh @@ -1,9 +1,8 @@ #! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +DIR="$(dirname "$(realpath -P "${0}")")" if [[ "${-}" =~ "x" ]]; then export INPUT_TRACE=1 fi -docker exec -it \ - -e "INPUT_TRACE=${INPUT_TRACE:-0}" \ - "$(docker ps --filter "label=name=mptcp-upstream-virtme-docker" -l --format "{{.ID}}")" \ - /entrypoint.sh connect "${@}" +bash "-${-}" "${DIR}/container.sh" /entrypoint.sh connect "${@}" diff --git a/container.sh b/container.sh new file mode 100755 index 0000000..33b3011 --- /dev/null +++ b/container.sh @@ -0,0 +1,7 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 + +docker exec -it \ + -e "INPUT_TRACE=${INPUT_TRACE:-0}" \ + "$(docker ps --filter "label=name=mptcp-upstream-virtme-docker" -l --format "{{.ID}}")" \ + "${@:-bash}"