tmux only shared variant (#3)
Reviewed-on: #3 Co-authored-by: Tomas Mirchev <contact@tomastm.com> Co-committed-by: Tomas Mirchev <contact@tomastm.com>
This commit was merged in pull request #3.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -euo pipefail
|
||||
|
||||
REGISTRY="registry.tomastm.com"
|
||||
|
||||
@@ -33,7 +33,7 @@ NAME="$1"
|
||||
CONTAINER_NAME="${IMAGE##*/}-${NAME}" # Use only the base image name (without tag)
|
||||
|
||||
exec_into_container() {
|
||||
docker exec --detach-keys "ctrl-q,ctrl-p" -it "$CONTAINER_NAME" bash -c "tmux new -A -s $NAME"
|
||||
docker exec --detach-keys "ctrl-q,ctrl-p" -it "$CONTAINER_NAME" bash -c "zsh"
|
||||
}
|
||||
|
||||
# Check if the container exists
|
||||
@@ -48,17 +48,15 @@ if [ "$(docker ps -a -q -f "name=$CONTAINER_NAME")" ]; then
|
||||
else
|
||||
echo "Container $CONTAINER_NAME does not exist. Creating and running it in detached mode..."
|
||||
docker run -d \
|
||||
--detach-keys "ctrl-q,ctrl-p" \
|
||||
--network host \
|
||||
-v "$HOME/.ssh:/home/dev/.ssh" \
|
||||
-v "$PWD:/workspace" \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--group-add $(getent group docker | cut -d: -f3) \
|
||||
--group-add "$(getent group docker | cut -d: -f3)" \
|
||||
--name "$CONTAINER_NAME" \
|
||||
--init \
|
||||
--init \ # run tini as PID 1 to handle signals & reap zombies for cleaner container shutdown
|
||||
"$FULL_IMAGE_NAME" \
|
||||
sleep infinity
|
||||
# tail -f /dev/null
|
||||
sleep infinity # use if coreutils not available: tail -f /dev/null
|
||||
fi
|
||||
|
||||
echo "Executing into container $CONTAINER_NAME..."
|
||||
|
||||
Reference in New Issue
Block a user