Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.

Dockerfile

Costa__Luís
Beginner
147 Views
0 Kudos
1 Reply
SIRIGIRI_V_Intel
Employee
147 Views

You can try using the below command:

sudo docker history <image_name> --no-trunc $argv  | tac | tr -s ' ' | cut -d " " -f 5- | sed 's,^/bin/sh -c #(nop) ,,g' | sed 's,^/bin/sh -c,RUN,g' | sed 's, && ,\n  & ,g' | sed 's,\s*[0-9]*[\.]*[0-9]*\s*[kMG]*B\s*$,,g' | head -n -1

Below is the explanation for the arguments used in the above command

tac                                             :   reverse the file
tr -s ' '                                       :   trim multiple whitespaces into 1
cut -d " " -f 5-                                :   remove the first fields (until X months/years ago)
sed 's,^/bin/sh -c #(nop) ,,g'                  :   remove /bin/sh calls for ENV,LABEL...
sed 's,^/bin/sh -c,RUN,g'                       :   remove /bin/sh calls for RUN
sed 's, && ,\n  & ,g'                           :   pretty print multi command lines following Docker best practices
sed 's,\s*[0-9]*[\.]*[0-9]*\s*[kMG]*B\s*$,,g'   :   remove layer size information
head -n -1                                      :   remove last line ("SIZE COMMENT" in this case)

It may not contain everything to fully understand how the image was generated. however it can extract some parts of the Dockerfile.

Hope this helps

Regards,

Ram prasad

Reply