2015-06-07 23:07:20 -04:00
|
|
|
<!--[metadata]>
|
|
|
|
+++
|
|
|
|
draft = true
|
|
|
|
title = "Container"
|
|
|
|
description = "Definitions of a container"
|
|
|
|
keywords = ["containers, lxc, concepts, explanation, image, container"]
|
|
|
|
[menu.main]
|
|
|
|
parent = "mn_reference"
|
|
|
|
+++
|
|
|
|
<![end-metadata]-->
|
2014-04-15 20:53:12 -04:00
|
|
|
|
|
|
|
# Container
|
|
|
|
|
|
|
|
## Introduction
|
|
|
|
|
2014-04-24 08:12:21 -04:00
|
|
|
![](/terms/images/docker-filesystems-busyboxrw.png)
|
2014-04-23 16:48:28 -04:00
|
|
|
|
2014-05-21 17:05:19 -04:00
|
|
|
Once you start a process in Docker from an [*Image*](/terms/image), Docker
|
|
|
|
fetches the image and its [*Parent Image*](/terms/image), and repeats the
|
|
|
|
process until it reaches the [*Base Image*](/terms/image/#base-image-def). Then
|
|
|
|
the [*Union File System*](/terms/layer) adds a read-write layer on top. That
|
|
|
|
read-write layer, plus the information about its [*Parent
|
|
|
|
Image*](/terms/image)
|
|
|
|
and some additional information like its unique id, networking
|
|
|
|
configuration, and resource limits is called a **container**.
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2015-04-21 11:50:09 -04:00
|
|
|
## Container state
|
2014-04-15 20:53:12 -04:00
|
|
|
|
2014-05-21 17:05:19 -04:00
|
|
|
Containers can change, and so they have state. A container may be
|
|
|
|
**running** or **exited**.
|
2014-04-15 20:53:12 -04:00
|
|
|
|
|
|
|
When a container is running, the idea of a "container" also includes a
|
|
|
|
tree of processes running on the CPU, isolated from the other processes
|
|
|
|
running on the host.
|
|
|
|
|
|
|
|
When the container is exited, the state of the file system and its exit
|
|
|
|
value is preserved. You can start, stop, and restart a container. The
|
|
|
|
processes restart from scratch (their memory state is **not** preserved
|
|
|
|
in a container), but the file system is just as it was when the
|
|
|
|
container was stopped.
|
|
|
|
|
2014-05-21 17:05:19 -04:00
|
|
|
You can promote a container to an [*Image*](/terms/image) with `docker commit`.
|
2014-04-23 16:48:28 -04:00
|
|
|
Once a container is an image, you can use it as a parent for new containers.
|
2014-04-15 20:53:12 -04:00
|
|
|
|
|
|
|
## Container IDs
|
|
|
|
|
|
|
|
All containers are identified by a 64 hexadecimal digit string
|
|
|
|
(internally a 256bit value). To simplify their use, a short ID of the
|
2014-05-21 17:05:19 -04:00
|
|
|
first 12 characters can be used on the command line. There is a small
|
2014-04-15 20:53:12 -04:00
|
|
|
possibility of short id collisions, so the docker server will always
|
|
|
|
return the long ID.
|