Docker-DCO-1.1-Signed-off-by: Fred Lifton <fred.lifton@docker.com> (github: fredfl)
| ... | ... |
@@ -3,140 +3,129 @@ page_description: Docker explained in depth |
| 3 | 3 |
page_keywords: docker, introduction, documentation, about, technology, understanding |
| 4 | 4 |
|
| 5 | 5 |
# Understanding Docker |
| 6 |
- |
|
| 7 | 6 |
**What is Docker?** |
| 8 | 7 |
|
| 9 |
-Docker is a platform for developing, shipping, and running applications. |
|
| 10 |
-Docker is designed to deliver your applications faster. With Docker you |
|
| 11 |
-can separate your applications from your infrastructure AND treat your |
|
| 12 |
-infrastructure like a managed application. We want to help you ship code |
|
| 13 |
-faster, test faster, deploy faster and shorten the cycle between writing |
|
| 14 |
-code and running code. |
|
| 15 |
- |
|
| 16 |
-Docker does this by combining a lightweight container virtualization |
|
| 17 |
-platform with workflow and tooling that helps you manage and deploy your |
|
| 18 |
-applications. |
|
| 19 |
- |
|
| 20 |
-At its core Docker provides a way to run almost any application securely |
|
| 21 |
-isolated into a container. The isolation and security allows you to run |
|
| 22 |
-many containers simultaneously on your host. The lightweight nature of |
|
| 23 |
-containers, which run without the extra overload of a hypervisor, means |
|
| 24 |
-you can get more out of your hardware. |
|
| 25 |
- |
|
| 26 |
-Surrounding the container virtualization, we provide tooling and a |
|
| 27 |
-platform to help you get your applications (and its supporting |
|
| 28 |
-components) into Docker containers, to distribute and ship those |
|
| 29 |
-containers to your teams to develop and test on them and then to deploy |
|
| 30 |
-those applications to your production environment whether it be in a |
|
| 31 |
-local data center or the Cloud. |
|
| 8 |
+Docker is an open platform for developing, shipping, and running applications. |
|
| 9 |
+Docker is designed to deliver your applications faster. With Docker you can |
|
| 10 |
+separate your applications from your infrastructure AND treat your |
|
| 11 |
+infrastructure like a managed application. Docker helps you ship code faster, |
|
| 12 |
+test faster, deploy faster, and shorten the cycle between writing code and |
|
| 13 |
+running code. |
|
| 14 |
+ |
|
| 15 |
+Docker does this by combining a lightweight container virtualization platform |
|
| 16 |
+with workflows and tooling that help you manage and deploy your applications. |
|
| 17 |
+ |
|
| 18 |
+At its core, Docker provides a way to run almost any application securely |
|
| 19 |
+isolated in a container. The isolation and security allow you to run many |
|
| 20 |
+containers simultaneously on your host. The lightweight nature of containers, |
|
| 21 |
+which run without the extra load of a hypervisor, means you can get more out of |
|
| 22 |
+your hardware. |
|
| 23 |
+ |
|
| 24 |
+Surrounding the container virtualization are tooling and a platform which can |
|
| 25 |
+help you in several ways: |
|
| 26 |
+ |
|
| 27 |
+* getting your applications (and supporting components) into Docker containers |
|
| 28 |
+* distributing and shipping those containers to your teams for further development |
|
| 29 |
+and testing |
|
| 30 |
+* deploying those applications to your production environment, |
|
| 31 |
+ whether it be in a local data center or the Cloud. |
|
| 32 | 32 |
|
| 33 | 33 |
## What can I use Docker for? |
| 34 | 34 |
|
| 35 |
-* Faster delivery of your applications |
|
| 35 |
+*Faster delivery of your applications* |
|
| 36 | 36 |
|
| 37 | 37 |
Docker is perfect for helping you with the development lifecycle. Docker |
| 38 |
-can allow your developers to develop on local containers that contain |
|
| 39 |
-your applications and services. It can integrate into a continuous |
|
| 40 |
-integration and deployment workflow. |
|
| 38 |
+allows your developers to develop on local containers that contain your |
|
| 39 |
+applications and services. It can then integrate into a continuous integration and |
|
| 40 |
+deployment workflow. |
|
| 41 | 41 |
|
| 42 |
-Your developers write code locally and share their development stack via |
|
| 43 |
-Docker with their colleagues. When they are ready they can push their |
|
| 44 |
-code and the stack they are developing on to a test environment and |
|
| 45 |
-execute any required tests. From the testing environment you can then |
|
| 46 |
-push your Docker images into production and deploy your code. |
|
| 42 |
+For example, your developers write code locally and share their development stack via |
|
| 43 |
+Docker with their colleagues. When they are ready, they push their code and the |
|
| 44 |
+stack they are developing onto a test environment and execute any required |
|
| 45 |
+tests. From the testing environment, you can then push the Docker images into |
|
| 46 |
+production and deploy your code. |
|
| 47 | 47 |
|
| 48 |
-* Deploy and scale more easily |
|
| 48 |
+*Deploying and scaling more easily* |
|
| 49 | 49 |
|
| 50 |
-Docker's container platform allows you to have highly portable |
|
| 51 |
-workloads. Docker containers can run on a developer's local host, on |
|
| 52 |
-physical or virtual machines in a data center or in the Cloud. |
|
| 50 |
+Docker's container-based platform allows for highly portable workloads. Docker |
|
| 51 |
+containers can run on a developer's local host, on physical or virtual machines |
|
| 52 |
+in a data center, or in the Cloud. |
|
| 53 | 53 |
|
| 54 |
-Docker's portability and lightweight nature also makes managing |
|
| 55 |
-workloads dynamically easy. You can use Docker to build and scale out |
|
| 56 |
-applications and services. Docker's speed means that scaling can be near |
|
| 57 |
-real time. |
|
| 54 |
+Docker's portability and lightweight nature also make dynamically managing |
|
| 55 |
+workloads easy. You can use Docker to quickly scale up or tear down applications |
|
| 56 |
+and services. Docker's speed means that scaling can be near real time. |
|
| 58 | 57 |
|
| 59 |
-* Get higher density and run more workloads |
|
| 58 |
+*Achieving higher density and running more workloads** |
|
| 60 | 59 |
|
| 61 |
-Docker is lightweight and fast. It provides a viable (and |
|
| 62 |
-cost-effective!) alternative to hypervisor-based virtual machines. This |
|
| 63 |
-is especially useful in high density environments, for example building |
|
| 64 |
-your own Cloud or Platform-as-a-Service. But it is also useful |
|
| 65 |
-for small and medium deployments where you want to get more out of the |
|
| 66 |
-resources you have. |
|
| 60 |
+Docker is lightweight and fast. It provides a viable, cost-effective alternative |
|
| 61 |
+to hypervisor-based virtual machines. This is especially useful in high density |
|
| 62 |
+environments: for example, building your own Cloud or Platform-as-a-Service. But |
|
| 63 |
+it is also useful for small and medium deployments where you want to get more |
|
| 64 |
+out of the resources you have. |
|
| 67 | 65 |
|
| 68 | 66 |
## What are the major Docker components? |
| 69 |
- |
|
| 70 | 67 |
Docker has two major components: |
| 71 | 68 |
|
| 69 |
+ |
|
| 72 | 70 |
* Docker: the open source container virtualization platform. |
| 73 | 71 |
* [Docker Hub](https://hub.docker.com): our Software-as-a-Service |
| 74 | 72 |
platform for sharing and managing Docker containers. |
| 75 | 73 |
|
| 76 |
-**Note:** Docker is licensed with the open source Apache 2.0 license. |
|
| 77 | 74 |
|
| 78 |
-## What is the architecture of Docker? |
|
| 75 |
+**Note:** Docker is licensed under the open source Apache 2.0 license. |
|
| 79 | 76 |
|
| 80 |
-Docker has a client-server architecture. The Docker *client* talks to |
|
| 81 |
-the Docker *daemon* which does the heavy lifting of building, running |
|
| 82 |
-and distributing your Docker containers. Both the Docker client and the |
|
| 83 |
-daemon *can* run on the same system, or you can connect a Docker client |
|
| 84 |
-with a remote Docker daemon. The Docker client and service can |
|
| 85 |
-communicate via sockets or through a RESTful API. |
|
| 77 |
+## What is Docker's architecture? |
|
| 78 |
+Docker uses a client-server architecture. The Docker *client* talks to the |
|
| 79 |
+Docker *daemon*, which does the heavy lifting of building, running, and |
|
| 80 |
+distributing your Docker containers. Both the Docker client and the daemon *can* |
|
| 81 |
+run on the same system, or you can connect a Docker client to a remote Docker |
|
| 82 |
+daemon. The Docker client and service communicate via sockets or through a |
|
| 83 |
+RESTful API. |
|
| 86 | 84 |
|
| 87 | 85 |
 |
| 88 | 86 |
|
| 89 | 87 |
### The Docker daemon |
| 88 |
+As shown in the diagram above, the Docker daemon runs on a host machine. The |
|
| 89 |
+user does not directly interact with the daemon, but instead through the Docker |
|
| 90 |
+client. |
|
| 90 | 91 |
|
| 91 |
-As shown on the diagram above, the Docker daemon runs on a host machine. |
|
| 92 |
-The user does not directly interact with the daemon, but instead through |
|
| 93 |
-the Docker client. |
|
| 94 |
- |
|
| 95 |
-### The Docker client |
|
| 96 |
- |
|
| 92 |
+### The Docker client |
|
| 97 | 93 |
The Docker client, in the form of the `docker` binary, is the primary user |
| 98 |
-interface to Docker. It is tasked with accepting commands from the user |
|
| 99 |
-and communicating back and forth with a Docker daemon. |
|
| 94 |
+interface to Docker. It accepts commands from the user and communicates back and |
|
| 95 |
+forth with a Docker daemon. |
|
| 100 | 96 |
|
| 101 |
-### Inside Docker |
|
| 97 |
+### Inside Docker |
|
| 98 |
+To understand Docker's internals, you need to know about three components: |
|
| 102 | 99 |
|
| 103 |
-Inside Docker there are three concepts we’ll need to understand: |
|
| 104 |
- |
|
| 105 |
-* Docker images. |
|
| 106 |
-* Docker registries. |
|
| 100 |
+* Docker images. |
|
| 101 |
+* Docker registries. |
|
| 107 | 102 |
* Docker containers. |
| 108 | 103 |
|
| 109 | 104 |
#### Docker images |
| 110 | 105 |
|
| 111 |
-The Docker image is a read-only template, for example an Ubuntu operating system |
|
| 112 |
-with Apache and your web application installed. Docker containers are |
|
| 113 |
-created from images. You can download Docker images that other people |
|
| 114 |
-have created or Docker provides a simple way to build new images or |
|
| 115 |
-update existing images. You can consider Docker images to be the **build** |
|
| 116 |
-portion of Docker. |
|
| 106 |
+A Docker image is a read-only template. For example, an image could contain an Ubuntu |
|
| 107 |
+operating system with Apache and your web application installed. Images are used to create |
|
| 108 |
+Docker containers. Docker provides a simple way to build new images or update existing |
|
| 109 |
+images, or you can download Docker images that other people have already created. |
|
| 110 |
+Docker images are the **build** component of Docker. |
|
| 117 | 111 |
|
| 118 | 112 |
#### Docker Registries |
| 119 |
- |
|
| 120 |
-Docker registries hold images. These are public (or private!) stores |
|
| 121 |
-that you can upload or download images to and from. The public Docker |
|
| 122 |
-registry is called [Docker Hub](https://hub.docker.com). It provides a |
|
| 123 |
-huge collection of existing images that you can use. These images can be |
|
| 124 |
-images you create yourself or you can make use of images that others |
|
| 125 |
-have previously created. You can consider Docker registries the |
|
| 126 |
-**distribution** portion of Docker. |
|
| 127 |
- |
|
| 128 |
-#### Docker containers |
|
| 129 |
- |
|
| 130 |
-Docker containers are like a directory. A Docker container holds |
|
| 131 |
-everything that is needed for an application to run. Each container is |
|
| 132 |
-created from a Docker image. Docker containers can be run, started, |
|
| 133 |
-stopped, moved and deleted. Each container is an isolated and secure |
|
| 134 |
-application platform. You can consider Docker containers the **run** |
|
| 135 |
-portion of Docker. |
|
| 136 |
- |
|
| 137 |
-## So how does Docker work? |
|
| 138 |
- |
|
| 139 |
-We've learned so far that: |
|
| 113 |
+Docker registries hold images. These are public or private stores from which you upload |
|
| 114 |
+or download images. The public Docker registry is called |
|
| 115 |
+[Docker Hub](http://index.docker.io). It provides a huge collection of existing |
|
| 116 |
+images for your use. These can be images you create yourself or you |
|
| 117 |
+can use images that others have previously created. Docker registries are the |
|
| 118 |
+**distribution** component of Docker. |
|
| 119 |
+ |
|
| 120 |
+####Docker containers |
|
| 121 |
+Docker containers are similar to a directory. A Docker container holds everything that |
|
| 122 |
+is needed for an application to run. Each container is created from a Docker |
|
| 123 |
+image. Docker containers can be run, started, stopped, moved, and deleted. Each |
|
| 124 |
+container is an isolated and secure application platform. Docker containers are the |
|
| 125 |
+ **run** component of Docker. |
|
| 126 |
+ |
|
| 127 |
+##So how does Docker work? |
|
| 128 |
+So far, we've learned that: |
|
| 140 | 129 |
|
| 141 | 130 |
1. You can build Docker images that hold your applications. |
| 142 | 131 |
2. You can create Docker containers from those Docker images to run your |
| ... | ... |
@@ -146,183 +135,150 @@ We've learned so far that: |
| 146 | 146 |
|
| 147 | 147 |
Let's look at how these elements combine together to make Docker work. |
| 148 | 148 |
|
| 149 |
-### How does a Docker Image work? |
|
| 150 |
- |
|
| 151 |
-We've already seen that Docker images are read-only templates that |
|
| 152 |
-Docker containers are launched from. Each image consists of a series of |
|
| 153 |
-layers. Docker makes use of [union file |
|
| 154 |
-systems](http://en.wikipedia.org/wiki/UnionFS) to combine these layers |
|
| 155 |
-into a single image. Union file systems allow files and directories of |
|
| 156 |
-separate file systems, known as branches, to be transparently overlaid, |
|
| 157 |
-forming a single coherent file system. |
|
| 158 |
- |
|
| 159 |
-One of the reasons Docker is so lightweight is because of these layers. |
|
| 160 |
-When you change a Docker image, for example update an application to a |
|
| 161 |
-new version, this builds a new layer. Hence, rather than replacing the whole |
|
| 162 |
-image or entirely rebuilding, as you may do with a virtual machine, only |
|
| 163 |
-that layer is added or updated. Now you don't need to distribute a whole new image, |
|
| 164 |
-just the update, making distributing Docker images fast and simple. |
|
| 165 |
- |
|
| 166 |
-Every image starts from a base image, for example `ubuntu`, a base Ubuntu |
|
| 167 |
-image, or `fedora`, a base Fedora image. You can also use images of your |
|
| 168 |
-own as the basis for a new image, for example if you have a base Apache |
|
| 169 |
-image you could use this as the base of all your web application images. |
|
| 170 |
- |
|
| 171 |
-> **Note:** |
|
| 172 |
-> Docker usually gets these base images from [Docker Hub](https://hub.docker.com). |
|
| 173 |
- |
|
| 174 |
-Docker images are then built from these base images using a simple |
|
| 175 |
-descriptive set of steps we call *instructions*. Each instruction |
|
| 176 |
-creates a new layer in our image. Instructions include steps like: |
|
| 177 |
- |
|
| 178 |
-* Run a command. |
|
| 179 |
-* Add a file or directory. |
|
| 180 |
-* Create an environment variable. |
|
| 181 |
-* What process to run when launching a container from this image. |
|
| 182 |
- |
|
| 183 |
-These instructions are stored in a file called a `Dockerfile`. Docker |
|
| 184 |
-reads this `Dockerfile` when you request an image be built, executes the |
|
| 185 |
-instructions and returns a final image. |
|
| 149 |
+### How does a Docker Image work? |
|
| 150 |
+We've already seen that Docker images are read-only templates from which Docker |
|
| 151 |
+containers are launched. Each image consists of a series of layers. Docker |
|
| 152 |
+makes use of [union file systems](http://en.wikipedia.org/wiki/UnionFS) to |
|
| 153 |
+combine these layers into a single image. Union file systems allow files and |
|
| 154 |
+directories of separate file systems, known as branches, to be transparently |
|
| 155 |
+overlaid, forming a single coherent file system. |
|
| 156 |
+ |
|
| 157 |
+One of the reasons Docker is so lightweight is because of these layers. When you |
|
| 158 |
+change a Docker image—for example, update an application to a new version— a new layer |
|
| 159 |
+gets built. Thus, rather than replacing the whole image or entirely |
|
| 160 |
+rebuilding, as you may do with a virtual machine, only that layer is added or |
|
| 161 |
+updated. Now you don't need to distribute a whole new image, just the update, |
|
| 162 |
+making distributing Docker images faster and simpler. |
|
| 163 |
+ |
|
| 164 |
+Every image starts from a base image, for example `ubuntu`, a base Ubuntu image, |
|
| 165 |
+or `fedora`, a base Fedora image. You can also use images of your own as the |
|
| 166 |
+basis for a new image, for example if you have a base Apache image you could use |
|
| 167 |
+this as the base of all your web application images. |
|
| 168 |
+ |
|
| 169 |
+> **Note:** Docker usually gets these base images from |
|
| 170 |
+> [Docker Hub](https://index.docker.io). |
|
| 171 |
+> |
|
| 172 |
+Docker images are then built from these base images using a simple, descriptive |
|
| 173 |
+set of steps we call *instructions*. Each instruction creates a new layer in our |
|
| 174 |
+image. Instructions include actions like: |
|
| 175 |
+ |
|
| 176 |
+* Run a command. * Add a file or directory. * Create an environment variable. * |
|
| 177 |
+What process to run when launching a container from this image. |
|
| 178 |
+ |
|
| 179 |
+These instructions are stored in a file called a `Dockerfile`. Docker reads this |
|
| 180 |
+`Dockerfile` when you request a build of an image, executes the instructions, and |
|
| 181 |
+returns a final image. |
|
| 186 | 182 |
|
| 187 | 183 |
### How does a Docker registry work? |
| 184 |
+The Docker registry is the store for your Docker images. Once you build a Docker |
|
| 185 |
+image you can *push* it to a public registry [Docker Hub](https://index.docker.io) or to |
|
| 186 |
+your own registry running behind your firewall. |
|
| 188 | 187 |
|
| 189 |
-The Docker registry is the store for your Docker images. Once you build |
|
| 190 |
-a Docker image you can *push* it to a public registry [Docker |
|
| 191 |
-Hub](https://hub.docker.com) or to your own registry running behind your |
|
| 192 |
-firewall. |
|
| 188 |
+Using the Docker client, you can search for already published images and then |
|
| 189 |
+pull them down to your Docker host to build containers from them. |
|
| 193 | 190 |
|
| 194 |
-Using the Docker client, you can search for already published images and |
|
| 195 |
-then pull them down to your Docker host to build containers from them. |
|
| 196 |
- |
|
| 197 |
-[Docker Hub](https://hub.docker.com) provides both public and |
|
| 198 |
-private storage for images. Public storage is searchable and can be |
|
| 199 |
-downloaded by anyone. Private storage is excluded from search |
|
| 200 |
-results and only you and your users can pull them down and use them to |
|
| 201 |
-build containers. You can [sign up for a plan |
|
| 202 |
-here](https://registry.hub.docker.com/plans/). |
|
| 191 |
+[Docker Hub](https://index.docker.io) provides both public and private storage |
|
| 192 |
+for images. Public storage is searchable and can be downloaded by anyone. |
|
| 193 |
+Private storage is excluded from search results and only you and your users can |
|
| 194 |
+pull images down and use them to build containers. You can [sign up for a storage plan |
|
| 195 |
+here](https://index.docker.io/plans). |
|
| 203 | 196 |
|
| 204 | 197 |
### How does a container work? |
| 205 |
- |
|
| 206 |
-A container consists of an operating system, user added files and |
|
| 207 |
-meta-data. As we've discovered each container is built from an image. That image tells |
|
| 208 |
-Docker what the container holds, what process to run when the container |
|
| 209 |
-is launched and a variety of other configuration data. The Docker image |
|
| 210 |
-is read-only. When Docker runs a container from an image it adds a |
|
| 211 |
-read-write layer on top of the image (using a union file system as we |
|
| 212 |
-saw earlier) in which your application is then run. |
|
| 198 |
+A container consists of an operating system, user-added files, and meta-data. As |
|
| 199 |
+we've seen, each container is built from an image. That image tells Docker |
|
| 200 |
+what the container holds, what process to run when the container is launched, and |
|
| 201 |
+a variety of other configuration data. The Docker image is read-only. When |
|
| 202 |
+Docker runs a container from an image, it adds a read-write layer on top of the |
|
| 203 |
+image (using a union file system as we saw earlier) in which your application can |
|
| 204 |
+then run. |
|
| 213 | 205 |
|
| 214 | 206 |
### What happens when you run a container? |
| 215 |
- |
|
| 216 |
-The Docker client using the `docker` binary, or via the API, tells the |
|
| 217 |
-Docker daemon to run a container. Let's take a look at what happens |
|
| 218 |
-next. |
|
| 207 |
+Either by using the `docker` binary or via the API, the Docker client tells the Docker |
|
| 208 |
+daemon to run a container. |
|
| 219 | 209 |
|
| 220 | 210 |
$ docker run -i -t ubuntu /bin/bash |
| 221 | 211 |
|
| 222 |
-Let's break down this command. The Docker client is launched using the |
|
| 223 |
-`docker` binary with the `run` option telling it to launch a new |
|
| 224 |
-container. The bare minimum the Docker client needs to tell the |
|
| 225 |
-Docker daemon to run the container is: |
|
| 212 |
+Let's break down this command. The Docker client is launched using the `docker` |
|
| 213 |
+binary with the `run` option telling it to launch a new container. The bare |
|
| 214 |
+minimum the Docker client needs to tell the Docker daemon to run the container |
|
| 215 |
+is: |
|
| 226 | 216 |
|
| 227 |
-* What Docker image to build the container from, here `ubuntu`, a base |
|
| 228 |
- Ubuntu image; |
|
| 217 |
+* What Docker image to build the container from, here `ubuntu`, a base Ubuntu |
|
| 218 |
+image; |
|
| 229 | 219 |
* The command you want to run inside the container when it is launched, |
| 230 |
- here `bin/bash` to shell the Bash shell inside the new container. |
|
| 231 |
- |
|
| 232 |
-So what happens under the covers when we run this command? |
|
| 233 |
- |
|
| 234 |
-Docker begins with: |
|
| 235 |
- |
|
| 236 |
-- **Pulling the `ubuntu` image:** |
|
| 237 |
- Docker checks for the presence of the `ubuntu` image and if it doesn't |
|
| 238 |
- exist locally on the host, then Docker downloads it from |
|
| 239 |
- [Docker Hub](https://hub.docker.com). If the image already exists then |
|
| 240 |
- Docker uses it for the new container. |
|
| 241 |
-- **Creates a new container:** |
|
| 242 |
- Once Docker has the image it creates a container from it: |
|
| 243 |
- * **Allocates a filesystem and mounts a read-write _layer_:** |
|
| 244 |
- The container is created in the file system and a read-write layer is |
|
| 245 |
- added to the image. |
|
| 246 |
- * **Allocates a network / bridge interface:** |
|
| 247 |
- Creates a network interface that allows the Docker container to talk to |
|
| 248 |
- the local host. |
|
| 249 |
- * **Sets up an IP address:** |
|
| 250 |
- Finds and attaches an available IP address from a pool. |
|
| 251 |
-- **Executes a process that you specify:** |
|
| 252 |
- Runs your application, and; |
|
| 253 |
-- **Captures and provides application output:** |
|
| 254 |
- Connects and logs standard input, outputs and errors for you to see how |
|
| 255 |
- your application is running. |
|
| 256 |
- |
|
| 257 |
-Now you have a running container! From here you can manage your running |
|
| 258 |
-container, interact with your application and then when finished stop |
|
| 259 |
-and remove your container. |
|
| 220 |
+here `bin/bash`, to start the Bash shell inside the new container. |
|
| 221 |
+ |
|
| 222 |
+So what happens under the hood when we run this command? |
|
| 223 |
+ |
|
| 224 |
+In order, Docker does the following: |
|
| 225 |
+ |
|
| 226 |
+- **Pulls the `ubuntu` image:** Docker checks for the presence of the `ubuntu` |
|
| 227 |
+image and, if it doesn't exist locally on the host, then Docker downloads it from |
|
| 228 |
+[Docker Hub](https://index.docker.io). If the image already exists, then Docker |
|
| 229 |
+uses it for the new container. |
|
| 230 |
+- **Creates a new container:** Once Docker has the image, it uses it to create a |
|
| 231 |
+container. |
|
| 232 |
+- **Allocates a filesystem and mounts a read-write _layer_:** The container is created in |
|
| 233 |
+the file system and a read-write layer is added to the image. |
|
| 234 |
+- **Allocates a network / bridge interface:** Creates a network interface that allows the |
|
| 235 |
+Docker container to talk to the local host. |
|
| 236 |
+- **Sets up an IP address:** Finds and attaches an available IP address from a pool. |
|
| 237 |
+- **Executes a process that you specify:** Runs your application, and; |
|
| 238 |
+- **Captures and provides application output:** Connects and logs standard input, outputs |
|
| 239 |
+and errors for you to see how your application is running. |
|
| 240 |
+ |
|
| 241 |
+You now have a running container! From here you can manage your container, interact with |
|
| 242 |
+your application and then, when finished, stop and remove your container. |
|
| 260 | 243 |
|
| 261 | 244 |
## The underlying technology |
| 262 |
- |
|
| 263 | 245 |
Docker is written in Go and makes use of several Linux kernel features to |
| 264 |
-deliver the features we've seen. |
|
| 246 |
+deliver the functionality we've seen. |
|
| 265 | 247 |
|
| 266 | 248 |
### Namespaces |
| 249 |
+Docker takes advantage of a technology called `namespaces` to provide the |
|
| 250 |
+isolated workspace we call the *container*. When you run a container, Docker |
|
| 251 |
+creates a set of *namespaces* for that container. |
|
| 267 | 252 |
|
| 268 |
-Docker takes advantage of a technology called `namespaces` to provide an |
|
| 269 |
-isolated workspace we call a *container*. When you run a container, |
|
| 270 |
-Docker creates a set of *namespaces* for that container. |
|
| 271 |
- |
|
| 272 |
-This provides a layer of isolation: each aspect of a container runs in |
|
| 273 |
-its own namespace and does not have access outside it. |
|
| 253 |
+This provides a layer of isolation: each aspect of a container runs in its own |
|
| 254 |
+namespace and does not have access outside it. |
|
| 274 | 255 |
|
| 275 | 256 |
Some of the namespaces that Docker uses are: |
| 276 | 257 |
|
| 277 |
- - **The `pid` namespace:** |
|
| 278 |
- Used for process isolation (PID: Process ID). |
|
| 279 |
- - **The `net` namespace:** |
|
| 280 |
- Used for managing network interfaces (NET: Networking). |
|
| 281 |
- - **The `ipc` namespace:** |
|
| 282 |
- Used for managing access to IPC resources (IPC: InterProcess |
|
| 283 |
-Communication). |
|
| 284 |
- - **The `mnt` namespace:** |
|
| 285 |
- Used for managing mount-points (MNT: Mount). |
|
| 286 |
- - **The `uts` namespace:** |
|
| 287 |
- Used for isolating kernel and version identifiers. (UTS: Unix Timesharing |
|
| 288 |
-System). |
|
| 258 |
+ - **The `pid` namespace:** Used for process isolation (PID: Process ID). |
|
| 259 |
+ - **The `net` namespace:** Used for managing network interfaces (NET: |
|
| 260 |
+ Networking). |
|
| 261 |
+ - **The `ipc` namespace:** Used for managing access to IPC |
|
| 262 |
+ resources (IPC: InterProcess Communication). |
|
| 263 |
+ - **The `mnt` namespace:** Used for managing mount-points (MNT: Mount). |
|
| 264 |
+ - **The `uts` namespace:** Used for isolating kernel and version identifiers. (UTS: Unix |
|
| 265 |
+Timesharing System). |
|
| 289 | 266 |
|
| 290 | 267 |
### Control groups |
| 291 |
- |
|
| 292 |
-Docker also makes use of another technology called `cgroups` or control |
|
| 293 |
-groups. A key need to run applications in isolation is to have them only |
|
| 294 |
-use the resources you want. This ensures containers are good |
|
| 295 |
-multi-tenant citizens on a host. Control groups allow Docker to |
|
| 296 |
-share available hardware resources to containers and if required, set up to |
|
| 297 |
-limits and constraints, for example limiting the memory available to a |
|
| 298 |
-specific container. |
|
| 268 |
+Docker also makes use of another technology called `cgroups` or control groups. |
|
| 269 |
+A key to running applications in isolation is to have them only use the |
|
| 270 |
+resources you want. This ensures containers are good multi-tenant citizens on a |
|
| 271 |
+host. Control groups allow Docker to share available hardware resources to |
|
| 272 |
+containers and, if required, set up limits and constraints. For example, |
|
| 273 |
+limiting the memory available to a specific container. |
|
| 299 | 274 |
|
| 300 | 275 |
### Union file systems |
| 301 |
- |
|
| 302 |
-Union file systems or UnionFS are file systems that operate by creating |
|
| 303 |
-layers, making them very lightweight and fast. Docker uses union file |
|
| 304 |
-systems to provide the building blocks for containers. We learned about |
|
| 305 |
-union file systems earlier in this document. Docker can make use of |
|
| 306 |
-several union file system variants including: AUFS, btrfs, vfs, and |
|
| 307 |
-DeviceMapper. |
|
| 308 |
- |
|
| 309 |
-### Container format |
|
| 310 |
- |
|
| 311 |
-Docker combines these components into a wrapper we call a container |
|
| 312 |
-format. The default container format is called `libcontainer`. Docker |
|
| 313 |
-also supports traditional Linux containers using |
|
| 314 |
-[LXC](https://linuxcontainers.org/). In future Docker may support other |
|
| 315 |
-container formats, for example integration with BSD Jails or Solaris |
|
| 316 |
-Zones. |
|
| 276 |
+Union file systems, or UnionFS, are file systems that operate by creating layers, |
|
| 277 |
+making them very lightweight and fast. Docker uses union file systems to provide |
|
| 278 |
+the building blocks for containers. Docker can make use of several union file system variants |
|
| 279 |
+including: AUFS, btrfs, vfs, and DeviceMapper. |
|
| 280 |
+ |
|
| 281 |
+### Container format |
|
| 282 |
+Docker combines these components into a wrapper we call a container format. The |
|
| 283 |
+default container format is called `libcontainer`. Docker also supports |
|
| 284 |
+traditional Linux containers using [LXC](https://linuxcontainers.org/). In the |
|
| 285 |
+future, Docker may support other container formats, for example, by integrating with |
|
| 286 |
+BSD Jails or Solaris Zones. |
|
| 317 | 287 |
|
| 318 | 288 |
## Next steps |
| 319 |
- |
|
| 320 | 289 |
### Installing Docker |
| 321 |
- |
|
| 322 |
-Visit the [installation](/installation/#installation) section. |
|
| 290 |
+Visit the [installation section](/installation/#installation). |
|
| 323 | 291 |
|
| 324 | 292 |
### The Docker User Guide |
| 325 |
- |
|
| 326 |
-[Learn how to use Docker](/userguide/). |
|
| 293 |
+[Learn Docker in depth](/userguide/). |
|
| 327 | 294 |
|
| 328 | 295 |
|