Add the ability to enter a running container

This commit is contained in:
Jose Diaz-Gonzalez
2016-08-29 08:19:59 -04:00
parent 5406b4dc07
commit d23b521142
3 changed files with 40 additions and 0 deletions

View File

@@ -102,6 +102,21 @@ service_alternative_alias() {
echo "$ALIAS"
}
service_enter() {
declare desc="enters running app container of specified proc type"
declare SERVICE="$1" && shift 1
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
local ID="$(cat "$SERVICE_ROOT/ID")"
docker inspect "$ID" &> /dev/null || dokku_log_fail "Container does not exist"
is_container_status "$ID" "Running" || dokku_log_fail "Container is not running"
local EXEC_CMD=""
has_tty && local DOKKU_RUN_OPTS+=" -i -t"
# shellcheck disable=SC2086
docker exec $DOKKU_RUN_OPTS $ID $EXEC_CMD "${@:-/bin/bash}"
}
service_exposed_ports() {
declare desc="Lists exposed ports for a service"
declare SERVICE="$1"