问题标签 [docker-network]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
570 浏览

docker - 使用同一个 VIP 的 docker swarm 服务

我们正在运行 docker 版本 17.06.0-ce,我对 docker 非常陌生(目前在网络/Linux 知识/经验很少的情况下快速学习它)。

我们拥有的环境之一是运行单个经理和工作人员。我们看到以下两种情况发生: - 正在为服务分配一个正在使用的 VIP,服务将无法启动,并出现“地址已在使用”错误。- 服务启动并使用与另一个服务相同的 VIP。这可以在管理器“docker service inspect”上看到。这会导致 nginx 向错误的服务发送请求(这可以在日志中看到)。

几个问题:1)有人遇到过这个吗?2) docker swarm 如何决定分配什么 VIP?3)docker如何知道在多工人环境中使用哪个VIP?我问的原因是因为在单个经理/工作人员环境中,您可以看到经理“docker service inspect”上的 VIP 与工作人员“docker network inspect ingress”相同,但在多经理/工作人员环境中,VIP 都是不同的。

0 投票
2 回答
899 浏览

docker - 同一覆盖网络中的 Docker swarm 节点无法互相看到

我的 swarm 中有一个奇怪的问题,同一网络内的 docker 服务无法通信,当我尝试在它们之间进行通信时出现以下错误:

我一直在调查它们是否在同一个网络上,并且根据检查它们是否在同一个网络覆盖中:

即使我尝试使用他们的 VIP(10.0.0.2 和 10.0.0.4),我也会遇到同样的错误。我不知道如何解决这个问题,任何想法都值得赞赏。

0 投票
2 回答
2235 浏览

mongodb - MongoDB Docker 容器:错误:无法将 pid 文件写入 /tmp/tmp.aLmNg7ilAm:设备上没有剩余空间

我像这样启动了一个 MongoDB 容器:

我看到我的 MongoDB 容器退出了:

我检查了我的 Docker 日志,我看到:

有谁知道这个错误是关于什么的?集装箱空间不够?

0 投票
1 回答
1756 浏览

docker - Docker 桥接网络 DNS

我有两个容器在默认的 docker bridge 网络上运行。守护进程在特定范围内为它们分配一个“临时”IP。

我怎样才能通过一些别名或名字联系到对方?

0 投票
2 回答
98 浏览

docker - 在 Docker 网络中跨容器连接

我有这个:

cdt-tests 容器正在尝试与同一网络中的其他容器建立连接。网络如下所示:

在我的 cdt-tests 容器中,我运行以下命令:

所有这些连接测试都失败了。有谁知道如何在同一个 Docker 网络中的容器之间连接?有什么万无一失的模式可以使用吗?

0 投票
2 回答
2822 浏览

docker - 我可以在 docker 容器中使用 pppoe 吗?

我有很多 pppoe 帐户,想用它们建立一个小型蜘蛛网络。

所以,我想用docker来虚拟化多个centos mehine并在里面做pppoe拨号。

我的methine有两个适配器,em1用于pppoe拨号,em2有一个静态IP地址。当我使用桥接器运行容器时,它使用 em2 并且可以访问 Internet。

我试过macvlan:

和主机模式:

似乎没有任何工作...

如何在容器中拨号并使用 em1 分配?

0 投票
1 回答
447 浏览

docker - 自动更新 iptables 转发规则到 docker swarm 上对应的 docker 服务端口

目标: 拥有一个类似脚本的脚本,它将调用 Docker API 自动为新的客户端主机创建新服务,然后根据新的服务端口更新所有 swarm 节点上的 iptables 转发规则。

问题: 为了轻松地将新客户端应用程序添加到新客户端主机,跨多个集群节点动态更新 iptables 规则的最佳/稳健方法是什么?

场景流程:

  1. 客户端主机直接连接到端口 80/tcp 上的网络负载平衡器。
  2. 网络平衡器从客户端主机接收流量并重定向到作为 docker swarm 节点的池主机。
  3. Docker swarm 节点只允许端口 80/tcp 上的连接。
  4. docker swarm 节点上的 IPTables 规则取决于客户端(源 IP)将流量重定向到正确的 docker swarm 服务(tcp 端口)。

场景图片:

场景(示例):

  • Docker Swarm 主机

    • master01 = ip 10.20.30.100
    • node01 = ip 10.20.30.161
    • node02 = ip 10.20.30.162
  • Docker 群服务

    • app01 = 端口 8081/tcp(属于 client01)
    • app02 = 8082/tcp端口(属于client02)
  • 客户端主机

    • client01 = ip 192.168.10.100
    • client02 = ip 192.168.10.200
  • 网络负载均衡器

    • 网络-lb = ip 10.10.10.10
    • 池 = ip [10.20.30.161, 10.20.30.162]
  • Swarm 节点上的 IPTables 规则

    • iptables -t nat -I PREROUTING -p tcp -s 192.168.10.100 --dport 80 -j REDIRECT --to-port 8081
    • iptables -t nat -I PREROUTING -p tcp -s 192.168.10.200 --dport 80 -j REDIRECT --to-port 8082
0 投票
1 回答
9490 浏览

docker - Docker:在分配给网络的默认值中找不到可用的、不重叠的 IPv4 地址池

当我尝试使用 docker-compose 部署我的应用程序时,我得到了以下错误:

现在我在这里和那里进行了一些研究,人们建议用docker network prune. 但由于我正在运行 34 个 docker 容器(我认为大约 30 个网络),它只会在错误再次发生之前修剪一两个旧网络。

我的问题是:如何确保我可以运行许多服务而不会遇到 docker 网络分配问题。(也许以某种方式创建更小的子网?)

我的 docker-compose 文件的最重要的网络部分如下所示:

0 投票
1 回答
9720 浏览

docker - 无法创建 docker 网络:在分配给网络的默认值中找不到可用的、不重叠的 IPv4 地址池

命令docker create network mynetwork给了我以下错误响应:

我用谷歌搜索了这个错误,但这些解决方案都不起作用

  1. 我只有 3 个预定义的 docker 网络,所以docker network prune没什么区别。
  2. 我从未安装过 OpenVPN

这是有关我的服务器环境的一些信息。操作系统:

核心:

码头工人:

执行时 Docker 守护程序的日志输出docker network create

感谢你的帮助!

0 投票
1 回答
1539 浏览

docker - customizing docker bridge network

I want my docker0 and all containers to have the same gateway address or be in the same IPrange as my local machine. I started by defining a fixed-cidr in ther daemon.json file /etc/docker/daemon.json

It seems to be working looking at the output of the ip -a It seems the docker0 has never received any data since.

The local machine and the docker0 are in same IP range with the same gateway. Good. But when I start the docker containers and inspected the bridge settings Everything was different. This is the output of

I don't understand why now IPAM config is having a IPv4 als auxiliary

"AuxiliaryAddresses": { "DefaultGatewayIPv4": "10.80.44.254" }

I realised that now the bridge is not created from the same subnet as it was configured by the daemon I it created 2 different bridges with different IP ranges. That is still the default from docker.

docker network ls

docker network inspect dockergitlab_default

I have no idea why the docker bridge is now created with the old default ip address.

LOCAL SYSTEM Details

I can do apt update on the local machine but when i logged into the gitlab-runner i can't do apt update

Is there a way I can oveeride the bridge settings. From what i have read, when I define/configure the cdir and gateway in daemon.json file everything will be taken from there for the creation of the bridge network and all other containers.

Thanks in Advance for your help.