Docker - Image
Table of Contents
1 - About
An image is a filesystem and parameters to use at runtime. It doesn’t have state and never changes.
A container is a running instance of an image.
A Docker image can:
- run a simple, single command and then exit.
- start software as complex as a database, wait for you (or someone else) to add data, store the data for later use, and then wait for the next person.
Using Docker Engine, you don’t have to worry about whether your computer can run the software in a Docker image — a Docker container can always run it.
Docker stores downloaded images on the Docker host.
2 - Articles Related
3 - Management
3.1 - Identification
imageId # or [user/]image:tag # or where tag default to latest (ie same repository:latest) [user/]repository
useridentify user images. The user that created the image. For example the image
training/sinatrahas been created by the user
3.2 - List
REPOSITORY TAG IMAGE ID CREATED SIZE docker-whale latest 1351cae1fdfb About a minute ago 275.1 MB ubuntu latest f753707788c5 7 weeks ago 127.2 MB hello-world latest c54a2cc56cbb 5 months ago 1.848 kB docker/whalesay latest 6b362a9f73eb 18 months ago 247 MB training/webapp latest 6fae60ef3446 19 months ago 348.8 MB
3.3 - Tag
A repository potentially holds multiple variants of an image
In the case of the ubuntu image, there is multiple variants covering Ubuntu 10.04, 12.04, 12.10, 13.04, 13.10 and 14.04. Each variant is identified by a tag and you can refer to a tagged image like so:
3.4 - Base
3.5 - Remove
3.6 - Visualization
Visualization of the image and their different layer:
3.7 - (Pre) load
Docker will automatically download any image you use that isn’t already present on the Docker host when you try to run it. If you want to pre-load an image you can download it using the
3.8 - Layer
When doing a pull, you can see that each layer of the image has been pulled down
docker pull centos
Using default tag: latest latest: Pulling from library/centos f1b10cd84249: Pull complete c852f6d61e65: Pull complete 7322fbe74aa5: Pull complete Digest: sha256:90305c9112250c7e3746425477f1c4ef112b03b4abe78c612e092037bfecc3b7 Status: Downloaded newer image for centos:latest
3.9 - Create
To create an image, you can
- use a Dockerfile to specify instructions to (create|build) an image.
- create a commit from an existing container
docker commit containerName imageName
3.10 - Update
You can update a container created from an image and commit the results to an image.
You can commit the changes made to an image
docker commit -m "Added json gem" -a "Kate Smith" 0b2616b0e5a8 ouruser/sinatra:v2
-m: commit message
-a: commit author
0b2616b0e5a8: the container ID
ouruser/sinatra:v2: the target image
3.11 - Searching
# docker search searchTerm docker search oracle
NAME DESCRIPTION STARS OFFICIAL AUTOMATED wnameless/oracle-xe-11g Oracle Express 11g R2 on Ubuntu 16.04 LTS 352 [OK] oraclelinux Oracle Linux is an open-source operating s... 260 [OK] alexeiled/docker-oracle-xe-11g This is a working (hopefully) Oracle XE 11... 185 [OK] sath89/oracle-12c Oracle Standard Edition 12c Release 1 with... 78 [OK] sath89/oracle-xe-11g Oracle xe 11g with database files mount su... 76 [OK]
OFFICIALmeans that it comes from an official repository
AUTOMATEDmeans that the build is automated.