-
Notifications
You must be signed in to change notification settings - Fork 878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a network namespace driver to libnetwork #372
Conversation
161a3fb
to
cab5bb9
Compare
…tainers to run in a pre-defined network namespace. It works by simply creating a symlink between the network namespace in /var/run/docker/netns and the provided network namespace. Signed-off-by: Alec Benson <albenson@redhat.com>
cab5bb9
to
35f6455
Compare
Hi @alecbenson thanks for your contribution. I've tagged this one for design review and hopefully one of the maintainers will be able to take a look and give you some feedback. I'm 👎 to this right now. The landscape has changed since moby/moby#8216 was raised - we now have a plugin framework and an ecosystem of network plugins. What use cases are we trying to address here that cannot be satisfied with network plugins? Additionally, it would seem that this patch is actually changing the SandboxAPI (in this case, One last point, the UI that you have in the docs doesn't map with what's being proposed in moby/moby#14593 - which is either The driver called by libnetwork is selected based on the network that a container is supposed to be connected to (iirc). I would think that in this case you would need to create one "network" backed by the "namespace" driver for each container, passing the path of the pre-created netns as a label on network creation.
Note: The contract of a network implies that all containers in a network can communicate freely which is why I'm recommending a network per netns |
Agreed with @dave-tucker. |
@dave-tucker I like the idea of
Which would also satisfy our needs, but how close is this to reality? |
All we want is the ability to create a network namespace on the host and then be able to use it within a container. |
@rhatdan @alecbenson I certainly understand the intent of the PR and I do see how this is beneficial for some use-cases. But, this is not in the spirit of the CNM Model, where the namespace is a black box for the drivers and that lets libnetwork core to provide a consistent experience to the applications using llibnetwork. Also, it impacts the upcoming changes that are related to User namespace support. |
@mavenugo How do you implement changes in the docker cli to use a network plugin? Is this possible? |
@rhatdan yes. It is currently available on the docker experimental channel. please refer to https://github.com/docker/docker/blob/master/experimental/networking.md. |
@mavenugo Thanks for the info. If I am understanding you correctly, you are saying is that the network namespace should be out of the scope of the driver? If that is the case, is there any way we can get this functionality using the plugin system that you linked? It is possible that I am mistaken -- but it seems that in any case, we would need to modify NewSandbox to prevent it from creating a network namespace and that cannot be done solely within the confinment of the driver. |
@alecbenson your understanding is correct. |
closing the issue based on the above explanation. feel free to reopen it if you still think this needs attention. |
Going back and reasing your answer to Alec back in August. Are you saying that the Plugin api will never support the use of external namespaces? IE Namespaces created outside of docker? |
This driver allows containers to run in a pre-defined network namespace (can be created via "ip netns add __", for example). It works by simply creating a symbolic link between the network namespace in /var/run/docker/netns/{id} and the provided network namespace.
This patch provides very similar functionality to the patch proposed here:
moby/moby#8216
However, this patch integrates into libnetwork and better conforms with Docker's "batteries included but removable" design goals. The namespace driver included in this PR offers Docker users much greater flexibility when deploying containers and removes the need for unsupported third party tools that attempt to achieve similar functionality.
Signed-off-by: Alec Benson albenson@redhat.com