Do a perfect match on the container name

This way we avoid to match every container that begins with the same
name.
This commit is contained in:
Loïc Guitaut
2015-11-19 16:40:00 +01:00
parent da91841ac6
commit ad4a945941
2 changed files with 2 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core named containers plugin"
version = "0.4.0"
version = "0.4.0.1"
[plugin.config]

View File

@@ -6,7 +6,7 @@ APP="$1"; APP_ROOT="$DOKKU_ROOT/$APP"
for container in "$APP_ROOT"/CONTAINER.*; do
DYNO=$(echo "$container" | sed -r 's/.*CONTAINER\.(.*)/\1/') || true
NAME="$APP.$DYNO"
PREVIOUS=$(docker ps -a -q -f name="$NAME") || true
PREVIOUS=$(docker ps -a -q -f name="$NAME\$") || true
if [[ -n $PREVIOUS ]]; then
docker rename "$NAME" "$NAME.$(date +%s)" > /dev/null
fi