Docker - Image

Card Puncher Data Processing

About

This page is about the container image in Docker.

OCI is the standardized container format used by Docker

Management

Location

Docker stores downloaded images on the Docker host at the Docker Root Dir location

sudo ls /var/lib/docker/image/aufs
distribution       imagedb            layerdb            repositories.json

Identification

imageId
# or
[user/]image:tag
# or where tag default to latest (ie same repository:latest)
[user/]repository  

where:

  • user identify user images. The user that created the image. For example the image training/sinatra has been created by the user training.

List

  • One
docker images --filter reference=image-name
  • All
docker images
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

where

  • repository is what repository they came from, for example ubuntu.
  • tag are the tags for each image, for example 14.04.
  • Image id: The image ID of each image.

Id

name[:tag]

where:

Name

[user/]name

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:

ubuntu:14.04

Base

A base image is a minimal linux image where you start to build more complicated image. See Docker - dockerfile

Example:

Remove

docker rmi -f (name or id)

where:

See also: Docker - Clean (Removing Image and Container)

Visualization

Visualization of the image and their different layer:

(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 docker pull

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

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

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

where:

  • -m: commit message
  • -a: commit author
  • 0b2616b0e5a8: the container ID
  • ouruser/sinatra:v2: the target image

Searching

https://hub.docker.com/

# 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]

where:

  • OFFICIAL means that it comes from an official repository
  • AUTOMATED means that the build is automated.

Run

A container is a running instance of an image that you create with a run command.

See Docker - Containers

Save / Export

docker save [OPTIONS] IMAGE [IMAGE...]

Inspect

To see the property of the image such as the entrypoint, you can use the inspect command

Documentation / Reference





Discover More
Card Puncher Data Processing
Docker

is a lightweight virtualization platform. allows you to run Linux and windows applications (image inside containers). The project provides the means of packaging applications in lightweight containers...
Docker Host Virtualbox
Docker - (Virtual) Host (or Machine or Server) - Docker Type

a machine where docker server run or a network An host (or machine) is: a virtual host that you can see running in your virtual machine provider (such as virtual box). is managed through the...
Architecture
Docker - Architecture

The docker architecture is composed of: an host where the daemon run a daemon that manage and run all Docker object (such as image and container) a registry to download and push image a docker...
Docker Build Context
Docker - Build (an image from a Dockerfile)

The build command creates an image from: a Dockerfile. and a context: A context is a list of files sent to the daemon Build an image where: with: -t defines the image name name:latest ....
Card Puncher Data Processing
Docker - Clean (Removing Image and Container)

Docker host disk sizing management. Docker stores all layers/images in its file formate (i.e. aufs) in default /var/lib/docker directory. Remove the container that where not used months ago See...
Card Puncher Data Processing
Docker - Commit (Image History)

Create a new image from a container's changes A RUN instruction in a build dockerfile generates commits. containers can then be created from any point in an image’s history, much like source control....
Docker For Windows Switch Container Type
Docker - Containers

in Docker. A container is a running instance of an image. Docker containers only run as long as the command you specify is active. A container ID uniquely identifies a container. A container...
Docker Daemon
Docker - Daemon - dockerd

The daemon is: a self-sufficient runtime for containers. a background service running on the host that manages building, running and distributing Docker containers. The daemon creates and manages...
Card Puncher Data Processing
Docker - Docker Root Dir (Docker Data Storage Path)

The docker root dir is the root path where all data docker is stored. Log into the host And select it where:
Docker Run Container Explainer
Docker - Getting Started

install docker To generate this message, Docker took the following steps: 1- The Docker client contacted the Docker daemon. 2- The Docker daemon pulled the “hello-world” image from the Docker...



Share this page:
Follow us:
Task Runner