Skip to content

Commit 1c0eccc

Browse files
committed
Add attach binstub
This should suffice for most cases, if you don't play around with docker ridiculously much, the containers will always have this naming scheme.
1 parent 7f7ec11 commit 1c0eccc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

bin/attach

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
if [[ $1 == "" ]]; then
4+
echo "No container to attach to given. Exiting."
5+
exit 0
6+
fi
7+
8+
BINDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
IFS='/' read -ra ADDR <<< "$BINDIR"
10+
POS=$((${#ADDR[@]} - 2))
11+
DIR=${ADDR[$POS]}
12+
13+
docker exec -it "${DIR}_$1_1" /bin/bash

0 commit comments

Comments
 (0)