Why doesn't Docker support multi-tenancy?
Asked Answered
B

2

10

I watched this YouTube video on Docker and at 22:00 the speaker (a Docker product manager) says:

"You're probably thinking 'Docker does not support multi-tenancy'...and you are right!"

But never is any explanation of why actually given. So I'm wondering: what did he mean by that? Why Docker doesn't support multi-tenancy?! If you Google "Docker multi-tenancy" you surprisingly get nothing!

Bloch answered 16/6, 2017 at 8:50 Comment(0)
C
9

One of the key features most assume with a multi-tenancy tool is isolation between each of the tenants. They should not be able to see or administer each others containers and/or data.

The docker-ce engine is a sysadmin level tool out of the box. Anyone that can start containers with arbitrary options has root access on the host. There are 3rd party tools like twistlock that connect with an authz plugin interface, but they only provide coarse access controls, each person is either allowed or disallowed from an entire class of activities, like starting containers, or viewing logs. Giving users access to either the TLS port or docker socket results in the users being lumped into a single category, there's no concept of groups or namespaces for the users connecting to a docker engine.

For multi-tenancy, docker would need to add a way to define users, and place them in a namespace that is only allowed to act on specific containers and volumes, and restrict options that allow breaking out of the container like changing capabilities or mounting arbitrary filesystems from the host. Docker's enterprise offering, UCP, does begin to add these features by using labels on objects, but I haven't had the time to evaluate whether this would provide a full multi-tenancy solution.

Chasidychasing answered 16/6, 2017 at 13:21 Comment(1)
@MeysamJavadi with enough configuration, you could setup a multi tenant environment with UCP. I'm also aware of more authz plugins now, including Open Policy Agent and Harbormaster.Chasidychasing
V
7

Tough question that others might know how to answer better than me. But here it goes.

Let's take this definition of multi tenancy (source):

Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers.

It's really hard to place Docker in this definition. It can be argued that it's both the instance and the application. And that's where the confusion comes from.

Let's break Docker up into three different parts: the daemon, the container and the application.

The daemon is installed on a host and runs Docker containers. The daemon does actually support multi tenancy, as it can be used my many users on the same system, each of which has their own configuration in ~/.docker.

Docker containers run a single process, which we'll refer to as the application.

The application can be anything. For this example, let's assume the Docker container runs a web application like a forum or something. The forum allows users to sign in and post under their name. It's a single instance that serves multiple customers. Thus it supports multi tenancy.

What we skipped over is the container and the question whether or not it supports multi tenancy. And this is where I think the answer to your question lies.

It is important to remember that Docker containers are not virtual machines. When using docker run [IMAGE], you are creating a new container instance. These instances are ephemeral and immutable. They run a single process, and exit as soon as the process exists. But they are not designed to have multiple users connect to them and run commands simultaneously. This is what multi tenancy would be. Instead, Docker containers are just isolated execution environments for processes.

Conceptually, echo Hello and docker run echo Hello are the same thing in this example. They both execute a command in a new execution environment (process vs. container), neither of which supports multi tenancy.

I hope this answers is readable and answers your question. Let me know if there is any part that I should clarify.

Vere answered 16/6, 2017 at 11:31 Comment(1)
In this example if my container runs ubuntu bash shell though and allows to shell in to the process/container.... could it support multiple people doing that as different unix users with their own root dirs..Barometrograph

© 2022 - 2024 — McMap. All rights reserved.