From f72bf5402d89262b10f50552cd2e2fbc9c33c1dd Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 6 Sep 2015 19:29:28 -0400 Subject: [PATCH] Label running containers This will avoid issues where `dokku cleanup` removes the stopped containers (it should not do so, and instead should allow them to stay in stopped mode). Containers will be labeled as follows: - service: dokku=service dokku.service=SERVICE_NAME - ambassador: dokku=ambassador dokku.ambassador=SERVICE_NAME To destroy the containers, simply run the `service:destroy` command. --- commands | 2 +- functions | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands b/commands index e8216ef..558bb3f 100755 --- a/commands +++ b/commands @@ -36,7 +36,7 @@ case "$1" in dokku_log_info1 "Starting container" SERVICE_NAME=$(get_service_name "$SERVICE") - ID=$(docker run --name "$SERVICE_NAME" -v "$SERVICE_ROOT/data:/data" -v "$SERVICE_ROOT/config:/usr/local/etc/redis" -d --restart always "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION") + ID=$(docker run --name "$SERVICE_NAME" -v "$SERVICE_ROOT/data:/data" -v "$SERVICE_ROOT/config:/usr/local/etc/redis" -d --restart always --label dokku=service --label dokku.service=redis "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION") echo "$ID" > "$SERVICE_ROOT/ID" dokku_log_verbose_quiet "Waiting for container to be ready" diff --git a/functions b/functions index 80d1e58..b74f770 100755 --- a/functions +++ b/functions @@ -175,7 +175,7 @@ service_port_unpause() { echo "${PORTS[@]}" > "$PORT_FILE" - docker run -d --link "$SERVICE_NAME:redis" --name "$EXPOSED_NAME" $(docker_ports_options "${PORTS[@]}") --restart always svendowideit/ambassador > /dev/null + docker run -d --link "$SERVICE_NAME:redis" --name "$EXPOSED_NAME" $(docker_ports_options "${PORTS[@]}") --restart always --label dokku=ambassador --label dokku.ambassador=redis svendowideit/ambassador > /dev/null if [[ "$LOG_FAIL" == "true" ]]; then dokku_log_info1 "Service $SERVICE exposed on port(s) ${PORTS[*]}" fi