This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker history --no-trunc --format "{{.CreatedBy}}" $1 | # extract information from layers | |
tac | # reverse the file | |
sed 's,^\(|3.*\)\?/bin/\(ba\)\?sh -c,RUN,' | # change /bin/(ba)?sh calls to RUN | |
sed 's,^RUN #(nop) *,,' | # remove RUN #(nop) calls for ENV,LABEL... | |
sed 's, *&& *, \\\n \&\& ,g' # pretty print multi command lines following Docker best practices |