Created
February 4, 2020 19:11
-
-
Save jwhitlock/0ed403ef4feeaf1ad4523632add2cab2 to your computer and use it in GitHub Desktop.
Compare contents of two docker images
This file contains hidden or 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 -x | |
| # https://github.com/mozilla/ichnaea/pull/1064 | |
| # opendiff is a recursive GUI diff tool on macOS | |
| # This script leaves a lot of files in the /tmp folder | |
| IMG_NAME=python:3.8.1-slim | |
| SHA1=89d719142de465e7c80195dff820a0bbbbba49b148fbd97abf4b58889372b5e3 | |
| SHA2=6ff55b7a7dd4db8cd8098ee78e06a4d64384ea0d6bd771c8dd3fc9da74c48c97 | |
| function scan_files { | |
| IMG=$1@sha256:$2 | |
| docker pull $IMG | |
| docker create --name="tmp_1" $IMG | |
| mkdir $3 | |
| cd $3 | |
| docker export tmp_1 | tar -xv | |
| cd - | |
| docker rm tmp_1 | |
| } | |
| OUT1=/tmp/dockerfiles.$SHA1 | |
| OUT2=/tmp/dockerfiles.$SHA2 | |
| scan_files $IMG_NAME $SHA1 $OUT1 | |
| scan_files $IMG_NAME $SHA2 $OUT2 | |
| opendiff $OUT1 $OUT2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment