Docker Containers

Containers are lightweight, portable, and self-contained environments that include everything an application needs to run, such as code, libraries, system tools, and dependencies.

A Docker container is a run-time instance of an Docker image. A Docker image can be thought of as a ready-to-go templated application. When you run an image it’s now a container and the application is running. In a similar sense this is the same as VMs whereby you have a VM template file with pre-configured settings and when you create a new VM you create a run-time instance of the VM template that runs the operating system.

Using Docker, developers can package their applications into containers and distribute them to different environments, such as development, testing, and production, without worrying about differences in the underlying infrastructure. Docker containers are designed to be platform-independent, which means they can run on any operating system that supports Docker.

One of the key benefits of Docker is its ability to isolate applications from their environment, which helps prevent conflicts between different applications and makes it easier to manage dependencies. Docker also enables developers to build and deploy applications faster by automating the process of building, testing, and deploying containers.

Reduce operations overhead

The traditional way to run applications is a 1:1 relationship between a VM running the server operating system and the application installed on top. This means you’re likely to have one VM per application. Scaling this out to the number of applications plus environments in a mid-plus-sized business and the overhead of operating all those VM operating systems with patches, resources, bug fixes, access management, backups, etc, can quickly become overbearing and cost a lot in terms of time and effort let alone the resources required just to run all those VMs.

Security considerations

Whilst containerized applications can help with efficient resource operations they do introduce new considerations regarding security.

Vulnerabilities in container images: Container images can contain outdated or vulnerable software packages and dependencies, which attackers can exploit.

Weak isolation: Containers run on a shared kernel, which means that if one container is compromised, other containers on the same host might also be at risk. This is different from virtual machines, which provide more robust isolation.

Privileged access: Running containers with excessive privileges can lead to security risks if a container is compromised.

Insecure container registries: If a container registry is not properly secured, attackers might push malicious images, which can be pulled and run by unsuspecting users.

Inadequate resource limits: Failing to set proper resource limits for containers can result in resource exhaustion attacks, affecting the performance and stability of the host system.

Network security: Containers often need to communicate with other containers or external services, making them susceptible to network-based attacks.

Misconfigurations: Configurations in container platforms, orchestration tools, and containers can lead to security vulnerabilities.

Monitoring and auditing: Limited visibility into container activities can make detecting and investigating security incidents difficult.

To address these security concerns, it is essential to follow best practices for container security, such as using minimal and up-to-date base images, implementing strong access controls, running containers with the least possible privileges, securing container registries, and monitoring container activities. Additionally, specialized container security tools can help identify and remediate vulnerabilities, enforce policies, and provide deeper visibility into container environments.

References

Getting Started

Demystifying Containers

Last modified July 21, 2024: update (e2ae86c)