Reputation: 11
I'm currently studying Docker for the lab use. Imagine this is my situation: I created a Docker image and then pushed it to the Docker Hub with my username(e.g. myname/lab1). Later on, my friend pulled my image and then commit some changes on it, then pushed it to the Docker Hub with his username (his/lab1). My question is, assume I'm able to pull his the image (his/lab1) which is built upon my original image, how can I find/list all the changes my friend made to my original image?
Many thanks!
Upvotes: 1
Views: 387
Reputation: 36893
You can use docker history <image_name/id>
▶ docker history ubuntu
IMAGE CREATED CREATED BY SIZE COMMENT
f7b3f317ec73 5 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
<missing> 5 weeks ago /bin/sh -c mkdir -p /run/systemd && echo '... 7 B
<missing> 5 weeks ago /bin/sh -c sed -i 's/^#\s*\(deb.*universe\... 2.76 kB
<missing> 5 weeks ago /bin/sh -c rm -rf /var/lib/apt/lists/* 0 B
<missing> 5 weeks ago /bin/sh -c set -xe && echo '#!/bin/sh' >... 745 B
<missing> 5 weeks ago /bin/sh -c #(nop) ADD file:141408db9037263... 117 MB
Add --no-trunc
in order to see the complete command (CREATED BY column).
However, IMHO the ideal way to work with your friend should be maintaining a versioned Dockerfile and see the changes there.
If you don't track your changes with Dockerfile, and you use docker commit
instead, it is more difficult to see the changes that a layer add. There is a proposal regarding this: https://github.com/moby/moby/issues/12641, that is still an Open Issue, as of Jun/2017.
Upvotes: 3