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

Proposed enhancement: search function #10

Open
skissane opened this issue Oct 17, 2022 · 0 comments
Open

Proposed enhancement: search function #10

skissane opened this issue Oct 17, 2022 · 0 comments

Comments

@skissane
Copy link

I have a Docker image. There is some path in it (let's call it /usr/bin/foo), but I'm not sure which command in the Dockerfile added that path.

I found a way of doing that, by combining this tool with a one-line Perl script:

docker image save $IMAGE | 
    dlayer -n 999999 |
    perl -ne 'chomp;$query=quotemeta("usr/bin/foo");$cmd=$_ if $_ =~ m/ [\$] /;print "$cmd\n\t$_\n" if m/ $query/;'

Now, while this works, it would be even better if dlayer had some kind of search function, so the Perl script was unnecessary. For example, maybe dlayer -p /usr/bin/foo would just print the layer containing /usr/bin/foo, if any.

That's the basic idea. Some possible elaborations:

  • support patterns (glob, maybe even regex), as opposed to just an exact match
  • distinguish in the command exit code between match found, no match found, and error (like grep for example does)
@skissane skissane changed the title Would be great if there was a search function Proposed enhancement: search function Oct 17, 2022
skissane pushed a commit to skissane/dlayer that referenced this issue Oct 17, 2022
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

No branches or pull requests

1 participant