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

Support docker-in-docker by only returning the oldest dockerd process #389

Merged
merged 1 commit into from
Jan 8, 2020

Conversation

sophomeric
Copy link
Contributor

Issue #, if available:

Description of changes:

Change the single pgrep occurance to pgrep -o, so that it can still match the main docker daemon process for those using docker-in-docker (dind). Else you end up with something like:

Trying to collect Docker daemon information... eks-log-collector.sh: line 503: [[: 4408
10332
13928: syntax error in expression (error token is "10332
13928")

	Warning: The Docker daemon is not running.

Because:

[ec2-user@ip-10-50-0-139 ~]$ pgrep dockerd
4408
10332
13928

[ec2-user@ip-10-50-0-139 ~]$ ps aufx | grep dockerd
root     10332  5.3  1.2 1148888 194396 ?      Sl   08:20   8:05  |       \_ dockerd
root     13928  1.6  0.5 950276 77848 ?        Sl   08:25   2:22          \_ dockerd
root      4408  2.5  0.5 2697464 92012 ?       Ssl  08:19   3:50 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

I considered using:

[ec2-user@ip-10-50-0-139 ~]$ pgrep -f /usr/bin/dockerd
4408

But as all docker-in-docker processes should be newer than the primary one, I preferred the -o should upstream ever change binary locations or in case someone is using their own custom built/compiled version in a different location.

Copy link

@mogren mogren left a comment

Choose a reason for hiding this comment

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

Thanks @sophomeric

@mogren mogren merged commit 7b33664 into awslabs:master Jan 8, 2020
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