Skip to content
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

Merged
merged 5 commits into from
Mar 20, 2019

Conversation

osterman
Copy link
Member

what

  • Update wrapper script to use the docker ps --filter option rather than pipe/grep pattern

why

@osterman osterman requested a review from Nuru March 20, 2019 20:33
@osterman osterman changed the title [wrapper] Use docker native filtering [rootfs/templates/wrapper] Use docker native filtering with ps Mar 20, 2019
echo "# Attaching to existing ${DOCKER_NAME} session"

local container_id=$(docker ps --quiet --filter name="${DOCKER_NAME}" --format "{{`{{ .ID }}`}}")
if [ -n "$container_id" ]; then
Copy link
Sponsor Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@osterman osterman requested a review from Nuru March 20, 2019 20:58
rootfs/templates/wrapper Outdated Show resolved Hide resolved
Nuru
Nuru previously approved these changes Mar 20, 2019
Copy link
Sponsor Contributor

@Nuru Nuru left a 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

@Nuru Nuru merged commit 3d00052 into master Mar 20, 2019
@osterman osterman deleted the docker-filter branch March 21, 2019 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants