Using docker, you can create images based on other images very nicely. For instance, you can make an image Java-jdk7 (based on the latest Ubuntu LTS), and based on that create images elastic-search and tomcat7 (both of which need java).
So, if I don't tag my images, I end up with the following (extract of docker images
):
╔══════════════════════╦════════╦══════════════╗ ║ REPOSITORY ║ TAG ║ ID ║ ╠══════════════════════╬════════╬══════════════╣ ║ ubuntu ║ 12.04 ║ 8dbd9e392a96 ║ ║ quintenk/jdk7-oracle ║ latest ║ 8928245086f4 ║ ║ quintenk/tomcat7 ║ latest ║ 995cdb2cbfa8 ║ ║ quintenk/elastics ║ latest ║ 123abc456ef2 ║ ╚══════════════════════╩════════╩══════════════╝
Now for the question. How do/should I maintain this dependency? How do I perform maintainance one 1 image and the dependent images as well?
apt-get upgrade
for instance), I assume I do not corrupt the dependent images? However, I also assume that the dependency tree is not as you would expect any longer. [UPDATE: I've reproduced this, so see my own answer below]Or is the way to go to tag the containers with a version number, and manually rebuild and redistribute all dependencies with increased version number tags? That would mean the Dockerfiles would need to be altered for an update.
UPDATE: I found the following image on the docker site in their presentation. However, I'm not quite sure on the steps of how to do this (especially with dependencies on other images as I described).
A Docker image contains a collection of read-only files (or layers) that amasses all the necessities—such as system tools, libraries, code, and other dependencies—required to launch a fully operational container environment.
The easiest way to make your images available for use by others inside or outside your organization is to use a Docker registry, such as Docker Hub, or by running your own private registry.
Dependencies can be defined between containers in the same pod, where the dependencies are specified by container names. Docker containers are started and stopped according to user-defined dependencies, or in arbitrary order if no dependencies are defined.
This is a great use case. Please submit an enhancement request on the Docker issues page.
A simple way for now is to maintain the Dockerfiles and update from there, rebuilding the images when you want to make a deliberate change.
In answer to
If I update my jdk image (apt-get upgrade for instance), I assume I do not corrupt the dependent images? However, I also assume that the dependency tree is not as you would expect any longer.
I've verified this by updating a dependent image, and checking out the dependencies. What you get is indeed a valid state, but the dependent image is not based on the image you'd naively expect any longer:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With