Docker Security: Potential Concerns and How to Deal with Them

By: Segiy Sergienko, 22 Apr 2019
5   min read
Reading Time: 5 minutes

Docker is a preferred solution for the majority of IT engineers worldwide. Statistics say that it is also the most popular and used container-based technology worldwide. And when choosing between a virtual machine or Docker, the latter option has many more significant advantages. But today, we are going to talk about the thing you may have difficulties with. We will discuss Docker security.

“What is wrong with Docker security?”, you ask. And really, its documentation along with reviews and blog posts dedicated to this topic highlight security as one of the Docker’s primary strengths.

Security threats and data protection are top information technology issues. User privacy demands and GDPR rules tell us that the software we build must meet these requirements precisely. And at first glance, Docker may seem to be quite sufficient in this respect.

There are four Docker container features that may serve as evidence that this technology is quite reliable:

Less software – fewer troubles

The size of Docker containers is so small, many potential risks and dangers are eliminated as such.

Task specification

Each container is responsible for specific functionality. It has a pre-defined path and configurations; thus, any vulnerability can be easily detected.

Complete isolation

Another aspect to keep in mind is that the containers are isolated but communicate with each other and the hosting system. This helps to avoid spreading an anomaly across the whole system.

Reproducibility as a great feature

The system’s architecture is built in a way that is quite understandable for any admin. The functionality can be easily inspected, and each step can be reproduced in order to reveal a potential issue.

Even though Docker seems to be quite reliable and safe, there are some concerns to be aware of. Don’t worry, we will highlight these concerns and provide you with detailed instructions on how to avoid the pitfalls and fix the gaps.

Five Docker Security Concerns to be Aware of

Deciding on Docker instead of a virtual machine, you should know about the potential risks.

Role management

Role management depends completely on the way you manage containers. There are many tools available, for example:

The size of your company matters, too. In the case of large enterprises, Active Directory is one of the most actively used solutions. The container integrates deeply with AD and leaves footprints in the enterprise system. The more complex a container you use, the greater the number of management tools you integrate, the higher are the risks of a data breach.

Managing big teams, role-based access control will be helpful. It allows managing access and permissions provided to various parties. (Read more: ARE DOCKER CONTAINERS SUITABLE FOR YOUR PROJECT?)

Container images

The container’s content is specified with images. Docker Hub allows free image sharing so there is the possibility some users will try to share malicious container images. This is a large potential vulnerability, and the vital thing is to make sure that images are uncompromised.

Most containers are able to scan images. So pay particular attention to the images you get from Docker Hub directly. A more reliable option is to host images on Docker Store or Gitlab. These resources get collections from trustworthy partners only. Thorough testing allows a container’s vulnerability to be revealed before it is used on a real project. A private container registry is useful, too: it provides the admin with full control over the images. Using a public key infrastructure mechanism, you get an opportunity to find out how each specialist, team or tool uses the image.

Secrets management

Within a Docker stack, apps use secrets to communicate with each other. A secret can be any type of information including passwords, security keys or tokens, TLS certificates, etc.

The significant thing is to encrypt the secrets: if unencrypted, they risk taking the whole of your system down and providing access to your data to wreckers. Secrets should be open only for the containers that use them and disappear once the container stops working. Remember that secrets must not be accessible to third parties, stored on a disk, or visible to the host.

Docker Swarm is responsible for encrypting and decrypting secret data. Additionally, Kubernetes functionality has recently been considerable improved, too. The tool now features secrets management automation. Now you can use this tool to create and encrypt data, as well as to configure secrets.

Lifecycle management

A container’s lifecycle includes three basic stages:

  • Constructing a container;
  • Upgrading a container with new updates and patches;
  • Deleting it.

The point is to secure the containers at every single stage. Every update may be risky, and it is much safer to eliminate a stage if possible. Thus, it is a better option to use immutable containers. What does this mean? It means that every time you need an update, you create a new image and build a new container based on it. You test it thoroughly, double-check security, and safely replace the old container with a new one, with no risky updates.

Do not hesitate to delete containers that have exist for too long. Their functionality now differs from the original, and it is more efficient and safer to replace them with new components. Also, take a closer look at the CIS Docker benchmark. Here, you can find out more about Docker security and its specifics.

Kernel and host threats

All Docker containers have two things in common. These are the host and the kernel. This simplifies work; however, is also enables possible vulnerabilities that may come from the kernel. How can you address these potential issues? Make sure the host system is properly patched. Besides, a tried and tested tip is to restrict access to privileged ports unless it is mandatory for an app to use them.

A breach in the host system is very dangerous and can lead to serious losses. Focus on implementing required security updates in time to avoid the risks.

Docker Security: Best Practices

Now that you are acquainted with the general concerns and basic ways to solve them, let’s find out more about how to ensure Docker security:

Content of containers

A container’s structure must be clear and declared from the moment it is created. If you use containers provided by third parties, there is a possibility these include things that weren’t in the static image initially. Avoid this, and make sure each container’s image includes everything needed beforehand.

Container orchestration

Containers are quite lightweight. On the one hand, that is their advantage as it allows you to maximize resource usage and scale costs. But on the contrary, troubles may appear when many processes need to access host resources simultaneously. Thus, you need a helping hand here.

Container orchestration tools like Amazon ECS, Azure Container Service and similar will be helpful for the following tasks:

  • Highlighting resource limits;
  • Patching vulnerabilities;
  • Fixing performance issues etc.

Super privileged mode

As we have mentioned above, role management is crucial. This particularly applies to super-privileged mode. Although it is not a default status, you should be aware of it. This concept violates container isolation, and containers that use this mode can endanger the entire system.

When granting permissions, provide it only to the apps that require high-level access.

Runtime protection

As we have defined above, you should be extremely careful with the access you give to third parties. Keep an eye on what each process can modify. Implement groups and namespace permissions.

Another actionable tip is to use a “nanosegmentation” approach. This limits potential harm if one of your containers tries to do something illegal.

Detect vulnerabilities in time

Vulnerability scanning tools are the things you need to keep a system safe and sound. They help to prevent potential container issues before deployment. Take a look at OpenScap Workbench, Dagda, Dockscan, and similar to prevent breaches in your system.

Final Thoughts

Docker is a great tool that replaces a virtual machine, demonstrates better performance, and provides more opportunities for admins. Its powerful ecosystem includes tools that take care of security, too. To make sure your system is protected, follow our simple recommendations and use the proper software solutions. If you still have questions, or any Docker vulnerability appears, just contact us! We are here to clarify this topic for you and help with addressing any issues.

Background form

Latest articles

The Ukrainian IT: Forged in the Fire of Adversity

8 Best PCB Design Software & How to Choose One?

Ways to Optimize Warehouse Picking and Packing Process (+IoT)