Docker basics¶

Docker is a containerisation system.Containerisation is also known as operating-system-level virtualisation. Itallows multiple independent containers to run on a single host. The containersare isolated from each other and from the host.

Resource isolation features make it possible for the containers to shareunderlying operating system resources. Whereas more traditional virtualmachines replicate an entire operating system, containerisation can provide amuch more lightweight solution to virtualisation, containing only the specificstack layers required for a particular application.

Docker containers are thus smaller and consume fewer resources, avoiding thememory and CPU overheads of full virtualisation. They are faster to start up,manage and scale, and easier to move, around than full virtual machines.

Docker on Macintosh and Windows¶

Docker requires a Linux host for its containers. On Linux systems, containerswill simply use the Linux operating system’s resources. Macintosh and Windowsneed to run a single Linux virtual machine to serve as the host.

This can be done in two ways:

  • On newer systems, the Alpine Linux hostis provided through native operating system virtualisation.

(On Macintosh, it’s provided by through HyperKit, a lightweightvirtualisation system built on top of the Hypervisor.framework (macOS10.10 Yosemite and higher).

On Windows, it’s provided through a similar system, Microsoft’s Hyper-V(Windows 10 Professional, Enterprise and Education editions).)

  • On older systems, it requires a Linux virtual machine running in VirtualBox. This is managed by a tool called Docker Toolbox.

Key components¶

The two key components in Docker are:

  • Docker Engine, the underlying daemon running on the host. Docker Engine isalso confusingly sometimes referred to simply as Docker (to make thingsworse, there is also a command-line tool named docker).
  • Docker Compose (invoked as docker-compose) is a tool for defining andmanaging multi-container applications.
    See Docker commands for the basics of docker and docker-composeusage.

Glossary¶

Application

Docker terminology uses “application” in much the same way that Django uses“project”, a collection of components that together form a complete andself-contained system.

In our case, a Docker application is the collection of components that isresponsible for a website and its functionality, including everything fromthe database to the frontend code.

Docker applications are typically managed using Docker Compose, and configured in a docker-compose.yml file.

A Docker application will typically include multiple containers.
Container
A Docker container is virtualised application environment. Unlike a virtualserver, it doesn’t need to provide every layer in a full working system.Instead, it encapsulates only the layers required to run an application.
Image
An image is a template. Each container is based on an image. Once an imagehas been created, each container created from it will provide exactly thesame environment, and the applications in it will behave identically. Animage is defined by its Dockerfile.

原文: http://docs.divio.com/en/latest/background/docker-basics.html