Dockerファイルの作業前後でgit commitすることで変更がかかったファイルを記録し、
buildが終わった後からgit log
すれば、差分を取得することができます。
FROM python:3.6-alpine
# gitをインストールして最初の状態を記録する
# 下記の場合,/usr/localの状態をgitにコミットしている
RUN apk install git; /
cd /usr/local; /
git init; /
git add *; /
git config --global user.email 'foo@example.com'; /
git commit -m 'init' /
# /usr/local/*を書き換える、何かのセットアップを行う
RUN ...
# セットアップ後のファイルを記録
RUN cd /usr/local; git add *; git commit -m 'after install 1'
# 記録は複数回行える
RUN ...
RUN cd /usr/local; git add *; git commit -m 'after install 2'
変更履歴を確認する
$ docker run .... /bin/sh
# cd /usr/local
# git log --stat
commit 9971bab2096e39cad69f15e2027dda53a58fb148 (HEAD -> master)
Author: root <foo@example.com>
Date: Sun Mar 3 00:00:00 2019 +0000
after install 2
bin/foo | Bin 0 -> 18576 bytes
bin/bar | Bin 0 -> 18576 bytes
...
こちらもおススメ