fix: only return one container when searching (#22)

This commit is contained in:
John Molakvoæ 2023-08-07 22:26:14 +02:00 committed by GitHub
parent 76bf57baf3
commit b639405e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,8 @@ fi
containerName="${containerName}${NEXTCLOUD_CONTAINER_NAME}" containerName="${containerName}${NEXTCLOUD_CONTAINER_NAME}"
# Get the ID of the container so we can exec something in it later # Get the ID of the first matching container so we can exec something in it later
docker ps --format '{{.Names}},{{.ID}}' | \ docker ps --format '{{.Names}},{{.ID}}' | \
egrep "^${containerName}${matchEnd}" | \ egrep "^${containerName}${matchEnd}" | \
awk '{split($0,a,","); print a[2]}' awk '{split($0,a,","); print a[2]}' | \
head -n 1