3
Docker is built around concept of layers which can be seen as delta updates.
4
- There are multiple read-only layers forming the static image and a single
5
writable layer on top of the image.
6
- Image + writable layer is a Container, a running copy of the image.
7
- Actually, also plus environment and plus mounted volumes
8
- The images may have a multiple associated containers (detached containers)
9
- Each container can be saved to create a new image
10
- The container data is persistented across runs, but can be easily reseted
11
from the image. Additionally, the persistent volumes from host system can be
12
mapped into the container.
13
- This can be either existing host directory or auto-created mapping
14
associated with container.
15
- Some of such mappings can be declared to hold temporary files during
16
the 'docker run' state
17
- Each command (event MAINTAINER) in docker file creates another layer.
18
This leads to layer poisoning and there is some limit to number of layers (127?)
19
- For this reason, normally multiple RUN commands are combined
20
- There are non-official squashing tools, but, then, all history is lost
21
https://github.com/jwilder/docker-squash
22
- Layers can be re-used by multiple containers. For this reason the proper
23
composition is important. For instance:
24
OpenSuSE -> mc -> adei
26
- There is no defined way how to start a new image. Rather docker recomends
27
to start of some exisiting docker image.
28
- OpenSuSE has Kiwi tool to build images (including docker ones) and it uses
29
the tool to build official OpenSuSE docker images. However, it recommends to
30
branch of the official OpenSuSE images, rather than using the tool itself.
33
https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/
37
- Create an container from the image
39
- Pause/Resume container
40
- Stop container (auto-restart can be configured)
41
- Optionally create a new image from the container
47
* Cron Jobs: Docker is designed to run a single application. There is a several ways to run cron in the container.
48
- Trigger cron job from the host system using docker exec. This is in-optimal as it will break when we start using
49
orchestration and allow container migration between nodes of the cluster.
50
- Run multiple services in container with 'supervisor' (python). Both cron and anacron seems required. Should
51
work, but goes a bit against the base idea of docker.
52
- Provide a minimal cron container which will trigger tasks in the main container with docker exec.
55
- We can't directly see free space on the host volumes from inside the container