docker - 在没有网络类型的情况下运行 docker 容器的用例

标签 docker networking

我知道 docker 没有网络类型,其中没有 IP 地址分配给容器,除了环回接口(interface)之外没有创建网络接口(interface)。

我想知道我们可以使用无网络类型的任何用例,我的意思是在哪种情况下我们需要运行没有 IP 或接口(interface)的容器。

我提到了这个question但它没有回答我们可以使用它的确切用例。

最佳答案

首先,如weaveworks/weave issue 1394所述:

the meaning of --net=none is not clear. It could mean "no networking at all" (in which case weave networking should be disabled too), or "no Docker networking" (which is the interpretation I am choosing here).

这就是wave network正在做:

We create a network namespace with --net=none, inject the weave interface and then start the actual container.
We also run a default gateway within the weave network that has external connectivity.

The reason we are doing this is that services tend to bind to the wrong interface. It's important to have a single interface that is created before the container is started.

您发现与 Calico 相似的用例;

This tutorial describes how to set up a Calico cluster in a Docker environment without Docker networking (i.e. –net=none).

With this option, Docker creates a container with its own network stack, but not to take any steps to configure its network.
Rather than have Docker configure the network, in this tutorial we use the calicoctl command line tool to add a container into a Calico network: adding the required interface and routes in to the container, and configuring Calico with the correct endpoint information.

关于docker - 在没有网络类型的情况下运行 docker 容器的用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47962803/

相关文章:

docker - 如何为图像位桶管道配置环境

c++ - Docker不启动cpp应用程序

c - 如何从 struct sockaddr 生成 struct addrinfo?

docker - 构建派生图像时无法在缓存中找到(本地)图像

java - 如何在 Tomcat 容器上运行 .jar?

Docker Kong 管理 API 无法访问

linux - 网络命名空间和桥接

linux - 当路由器端口转发外部连接时,如何从 LAN 内部连接到 ftp 服务器

c# - 最大化任务并发性 - 使用 TCP/IP 和特定端口过滤

windows - 适用于 Windows 的 Docker : cannot assign requested address