Why doesn't Docker support multi-tenancy?

孤者浪人 提交于 2019-12-23 13:33:02

问题


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!


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/44584841/why-doesnt-docker-support-multi-tenancy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!