Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage docker image dependencies (maintainance)

Tags:

docker

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?

  1. 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. [UPDATE: I've reproduced this, so see my own answer below]
  2. If 1 is correct, is there some way that I can have the dependent images flag themselves as outdated, and (hopefully) have them rebuild themselves?

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).

Update flow for docker containers

like image 531
qkrijger Avatar asked Jul 30 '13 09:07

qkrijger


People also ask

Does docker image contain dependencies?

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.

How do you manage docker images?

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.

What are docker dependencies?

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.


Video Answer


2 Answers

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.

like image 109
Nick Stinemates Avatar answered Sep 20 '22 15:09

Nick Stinemates


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:

docker dependency tree

like image 42
qkrijger Avatar answered Sep 18 '22 15:09

qkrijger