Capítulo 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.
A Red Hat está também fornecendo o Kubernetes para utilizar nos containers de orquestra. Para mais informações sobre os Kubernetes veja Inicie a Orquestra do Docker Containers com 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:
  • Container – um sandbox de aplicativo. Cada container é baseado em uma imagem que possui dados de configuração necessária. Quando você lançar um container de uma imagem, uma camada gravável será adicionada em cima desta imagem. Todas as vezes que você salvar um container (utilizando o comando docker commit), uma camada de imagem nova será adicionada para armazenar suas mudanças.
  • Image – um snapshot estático de configuração de containers. A imagem é uma camada de somente leitura que nunca é modificada, todas as mudanças são realizadas na primeira camada de cima e pode ser salva somente ao criar uma nova imagem. Cada imagem depende de uma uma mais imagens pai.
  • 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 Figura 11.1, “Camada de Imagem Utilizando Formato Docker”.
  • Registry – um repositório de imagens. Os registros são repositórios público ou privados que contém imagens disponíveis para download. Alguns registros permitem que usuários carreguem imagens para disponibilizá-los à outros.
  • Dockerfile – um arquivo de configuração com instruções de construção para as imagens de Docker. Os Dockerfiles fornecem uma forma de automatizar, reutilizar e compartilhar procedimentos de construção.
Camada de Imagem Utilizando Formato Docker

Figura 11.1. Camada de Imagem Utilizando Formato Docker