----- Original Message ----- > From: "Daniel J Walsh" <dwa...@redhat.com> > To: atomic-devel@projectatomic.io > Sent: Wednesday, April 22, 2015 7:10:33 PM > Subject: [atomic-devel] Looking at adding version support to the atomic > command. > > One of the things I would like to return is version information about an > image. The version content could be stored as LABELS in the dockerfile. > > For example if you had > >
Is there no way to add this directly to Docker instead of re-using the label? -Mike > FROM fedora > MAINTAINER Dan Walsh > ENV container docker > RUN yum -y update; yum -y install httpd; yum clean all; systemctl enable > httpd > > LABEL Name=Apache > LABEL Version=1.0 > LABEL Release=1 > LABEL Vendor="Red Hat" License=GPLv3 > LABEL INSTALL="docker run --rm --privileged -v /:/host -e HOST=/host -e > LOGDIR=${LOGDIR} -e CONFDIR=${CONFDIR} -e DATADIR=${DATADIR} -e > IMAGE=IMAGE -e NAME=NAME IMAGE /bin/install.sh" > LABEL UNINSTALL="docker run --rm --privileged -v /:/host -e HOST=/host > -e IMAGE=IMAGE -e NAME=NAME IMAGE /bin/uninstall.sh" > ADD root / > > EXPOSE 80 > RUN rm -f /etc/machine-id > LABEL RUN echo '$PWD' '$(id -u)' > > CMD [ "/sbin/init" ] > > And did a docker build -t test . > > > Now you could execute > > atomic version test, which would print the ID, The Name:Version:Release > as specified in the Image labels. And finally the tag if it exists. > > atomic version test > afecc5f6a3c4d8f2326901c94cdf84aab0890ea827c38f2b0d2e2a4ba5ace7d6 > Apache:1.0:1 test:latest > > Another feature I have added is, the ability to recurse though all of > the layers of the image. > > atomic version -r test > afecc5f6a3c4d8f2326901c94cdf84aab0890ea827c38f2b0d2e2a4ba5ace7d6 > Apache:1.0:1 test:latest > 21b2d6e4171b024cb48bb2d02d626481e37724a6e03dac7962e44cc8612fbf22 > Apache:1.0:1 > 83202d54cf27439381b3d668d02f3a21cb75ebba4623d86e1fdbad614660424e > Apache:1.0:1 > 90ff7403d883c0ccde72bf630cb77e224fd6b517fc4b61b84f8d9739dab93c9f > Apache:1.0:1 > 12f19f77bc52483d902727b6c142f20cc79109ad45e36869f30c15228534eb5b > Apache:1.0:1 > 4bcd0ad4dbe8c39f49094c3f13c8aa517efe6c76de1aacb6fca413ee3372dd98 > Apache:1.0:1 > fabaf6ef3297a7d6006ee24034aa2ba525f064f108580d4b44944e24b1581513 > Apache:1.0:1 > eb10dd5ab6a2a649d5e069c67fdd71506db0b0a1e4a5b5680c1d3f317bfa320a > Apache:1.0:1 > b0bc3c982c88037a5e7b6e7e6de900981c9f90516014b7071fe860ca39a22d02 > Apache:1.0:1 > 99878fca96575b6ccac2fa54a2f2a44ad85d94344e8fbde5ae2350e3b5eec98b Apache:1.0: > fc8782dfd543be2a582cf8ee7eff4e39c46a980f212891342ac4c6c6917ee211 Apache:: > cf6c210ea5b979204df75ad4aeaa3dcb971589c2399d79e6c2a71e7588e95cd9 :: > 4dab839254d036da5ad52f459d6602b1a84f379fe94c722bd969db14e119189a :: > 011c13014fd9ede3e53119f380e20b88af2e8bd40afb1b3925ed39cbd067e453 :: > 834629358fe214f210b0ed606fba2c17827d7a46dd74bd3309afc2a103ad0e89 :: > fedora:21 > 00a0c78eeb6d81442efcd1d7c02e8b141745e3a06f1ee3458e1bae628e0067d3 :: > 511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158 :: > > Which looks better on a terminal then in email. > > I guess the only question would be what should the output look like. > The nice feature of this is you would know that the test container is > based on the > fedora:21 package. > > > Wanted the tool to not only get the Label Version but also the tag if it > exists, and added recursion. > > >