Skip to content

Proposed enhancement: search function #10

@skissane

Description

@skissane

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions