dev allow specifying tag
This commit is contained in:
parent
c119e3fce5
commit
a976ea3861
@ -13,8 +13,9 @@ usage() {
|
||||
while getopts ":i:" opt; do
|
||||
case ${opt} in
|
||||
i )
|
||||
IMAGE="${OPTARG}" # User-provided image (without registry)
|
||||
FULL_IMAGE_NAME="${REGISTRY}/${IMAGE}" # Full registry image path
|
||||
IFS=':' read -r IMAGE IMAGE_TAG <<< "${OPTARG}" # Split image and tag
|
||||
IMAGE_TAG=${IMAGE_TAG:-latest} # Default to 'latest' if no tag is provided
|
||||
FULL_IMAGE_NAME="${REGISTRY}/${OPTARG}" # Keep the full image name with tag
|
||||
;;
|
||||
\? )
|
||||
usage
|
||||
@ -29,7 +30,7 @@ if [ -z "$FULL_IMAGE_NAME" ] || [ -z "$1" ]; then
|
||||
fi
|
||||
|
||||
NAME="$1"
|
||||
CONTAINER_NAME="${IMAGE}-${NAME}"
|
||||
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"
|
||||
@ -61,3 +62,4 @@ fi
|
||||
|
||||
echo "Executing into container $CONTAINER_NAME..."
|
||||
exec_into_container
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user