52579827be
- Naming convention in Docker Swarm: Fixes #14 - Compose v2 uses `-` separator instead of `_`: Fixes #10
15 lines
415 B
Bash
Executable file
15 lines
415 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if [[ ! -z "$NEXTCLOUD_PROJECT_NAME" ]]; then
|
|
containerName="${NEXTCLOUD_PROJECT_NAME}[_-]"
|
|
else
|
|
matchEnd="(,|\.\d+)"
|
|
fi
|
|
|
|
containerName="${containerName}${NEXTCLOUD_CONTAINER_NAME}"
|
|
|
|
# Get the ID of the container so we can exec something in it later
|
|
docker ps --format '{{.Names}},{{.ID}}' | \
|
|
egrep "^${containerName}${matchEnd}" | \
|
|
awk '{split($0,a,","); print a[2]}'
|