Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer
of abstraction and automation of operating-system-level virtualization on Linux.
Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent "containers"
to run within a single Linux instance, avoiding the overhead of starting virtual machines.
The latest Docker version can be downloaded from:
http://www.docker.com
Docker image
Information
Images contains all the data and meta data needed to run the container and containers are launched from images.
- Images can be seen as:
- static or frozen versions of a container and a container is a running barebone Linux instance
- build-time construct and the containers as its run-time constructs
- a class and its running containers as objects
- Docker Linux OS images (for example: ubuntu, fedora, centos and coreos) are barebone Linux OS, just enough to create a
functioning runtime Linux OS (non-essential files, such as man pages are not included).
- Images are stacked or layered and image layering is accomplished through union mounts and aufs is the default union mount
implementation used on Ubuntu hosts running docker.
- In Ubuntu the images are stored under: /var/lib/docker/aufs/
- Below layer 0 is the bootfs. It is a short lived layer which does not exists when the container is started.
- The bottom image layer 0 is called the base image which contains the root filesystem (rootfs).
- On top of layer 0 are the read only layers (1 ... n-1) which may contains changes on the base image.
If changes overlap each other (conflicts) the change on the top layer wins.
- When the container is launched a top layer is created which is writable.
All changes to the container at runtime are commited to this layer.
If you need to update a file which exist in the lower layer, you need to copy this file to the top layer
and make changes to it.
- All stacked layers combined is the single image which can be shared by multiple containers.
Operating system used
Windows Vista Home Premium SP 2
Software prerequisites
Docker on Windows
Procedure
- To install the latest fedora image from Docker Hub without running it on your local host, type:
docker pull fedora
- To install all fedora images, type: docker pull -a fedora
- To show which fedora images are installed locally, type: docker images fedora
- By looking at the image ids (f62b..., e26e..., d7f0...), there are 3 different fedora versions.
- An image id can have 1 or more tags
- The image id "e26efd..." is the latest version because it has the tag "latest".
- To see how the image layer hierarchy looks like, type: docker images --tree
Looking at the fedora latest tag:
- The base image layer 0 has image id: 48ecf...
- Layer 1 has image id: e26ef...
- Goto location where the read only images layers are stored, type: cd /var/lib/docker/aufs/layers
Show the content of this folder: type: ls -l
- The image layers are files containing image ids.
Some files have size 0, meaning these image layers are base image layers.
The file 48ecf.. has file size 0.
To show the content of such a layer, type: more e26efd [press Tab to autocomplete the filename]
In this example the file only contains one image id. If there are multiple image ids, these ids are ordered in the same way the images are stacked.
- Goto location where the writable top image layers are stored, type: cd /var/lib/docker/aufs/diff
Show the content of this folder: type: ls -l
- The image layers are directories, type: cd e26efd [press Tab to autocomplete the directory name]
Show the content of this folder: type: ls -l
In this example this folder contains all the files and directories which makes up the fedora docker image.
|
|