Глава 11. Linux Containers

The Docker project is an open-source project that automates the deployment of applications inside Linux Containers, and provides the capability to package an application with its runtime dependencies into a container. It provides a command-line tool for the life cycle management of image-based containers. Linux containers enable rapid application deployment, simpler testing, maintenance, and troubleshooting while improving security. Using Red Hat Enterprise Linux 7 with containers allows customers to increase staff efficiency, deploy third-party applications faster, enable a more agile development environment, and manage resources more tightly.
To quickly get up-and-running with docker formatted containers, refer to Get Started with docker Formatted Containers.
Red Hat Enterprise Linux 7.1 ships with docker version 1.4.1, which includes a number of new features, security fixes, patches and changes. Highlights include:
  • The ENV instruction in the Dockerfile now supports arguments in the form of ENV name=value name2=value2 ...
  • An experimental overlayfs storage driver has been introduced.
  • An update is included for CVE-2014-9356: Path traversal during processing of absolute symlinks. Absolute symlinks were not adequately checked for traversal which created a vulnerability via image extraction and/or volume mounts.
  • An update is included for CVE-2014-9357: Escalation of privileges during decompression of LZMA (.xz) archives. Docker 1.3.2 added chroot for archive extraction. This created a vulnerability that could allow malicious images or builds to write files to the host system and escape containerization, leading to privilege escalation.
  • An update is included for CVE-2014-9358: Path traversal and spoofing opportunities via image identifiers. Image IDs passed either via docker load or registry communications were not sufficiently validated. This created a vulnerability to path traversal attacks wherein malicious images or repository spoofing could lead to graph corruption and manipulation.
Red Hat provides platform container images for building applications on both Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7.
Дополнительно предлагается приложение Kubernetes для одновременного управления группами контейнеров. Подробную информацию можно найти в документе Управление контейнерами Docker с помощью Kubernetes.
Linux containers are supported running on hosts with SELinux enabled. SELinux is not supported when the /var/lib/docker directory is located on a volume using the B-tree file system (Btrfs).

11.1. Components of docker Formatted Containers

The docker container format works with the following fundamental components:
  • Контейнер — изолированный экземпляр операционной системы на базе образа. При запуске контейнера из образа будет добавлен дополнительный слой образа. Сделанные в контейнере изменения можно сохранить в новый слой образа при помощи команды docker commit.
  • Образ — статический снимок конфигурации контейнера, доступный только для чтения. Изменения будут применяться к образу на верхнем слое, после чего его можно будет сохранить в новый образ. Образ может быть связан с одним или несколькими родительскими образами.
  • Platform Container Image – an image that has no parent. Platform container images define the runtime environment, packages, and utilities necessary for a containerized application to run. The platform image is read-only, so any changes are reflected in the copied images stacked on top of it. See an example of such stacking in Рисунок 11.1, «Иерархия образов в Docker».
  • Реестр — полный комплект образов. Реестр может быть открытым или закрытым. В некоторые реестры можно добавлять образы, тем самым разрешая их загрузку другими пользователями.
  • Dockerfile — файл конфигурации с командами сборки образов. С его помощью можно стандартизировать и автоматизировать процесс сборки.
Иерархия образов в Docker

Рисунок 11.1. Иерархия образов в Docker