-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rootfs/templates/wrapper] Use docker native filtering with ps #416
Conversation
echo "# Attaching to existing ${DOCKER_NAME} session" | ||
|
||
local container_id=$(docker ps --quiet --filter name="${DOCKER_NAME}" --format "{{`{{ .ID }}`}}") | ||
if [ -n "$container_id" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets around the pipefail
problem, but perpetuates another problem, such as if one container's name is a substring of another's it will match (men.cloudposse.co
will match women.cloudposse.co
). Is there a more robust way to check for this container being run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you add a comment about all the braces in the --format '{{``{{ .ID }}``}}'
parameter
what
docker ps --filter
option rather than pipe/grep patternwhy
pipefail
is unreliable, so lets just eliminate it as a factor in this case