【问题标题】:docker swarm init --advertise-addr when IP address randomly changesdocker swarm init --advertise-addr 当 IP 地址随机变化时
【发布时间】:2022-06-20 08:32:51
【问题描述】:

我想试试docker swarm 的能力。

当我运行命令docker swarm init 时,我收到错误消息:

could not choose an IP address to advertise since this system has multiple addresses on different interfaces (1.1.1.1 on enp89s0 and 2.2.2.2 on eno2) - specify on with the --advertise-addr

然后我尝试了这个命令docker swarm init --advertise-addr eno2,但这给出了错误:

Error response from daemon: interface eno2 has more than one IPv6 address (1111:1111::1111:1111:1111:1111 and 2222::2222:2222:2222:2222)

我还有一个额外的挑战,即我的 IPv6 和 IPv4 地址有时会随机更改。我更喜欢使用不提及任何特定 IP 地址的参数运行 docker swarm init。我可以只使用网络接口名称和/或我的网络的其他常量属性名称来启动 docker swarm 吗?

还有谁知道 docker swarm 在 IP 地址变化时是否会稳定?

【问题讨论】:

    标签: docker


    【解决方案1】:

    我也有餐桌工人(ip6)和主人(ip4+ip6)。需要监听 ip6 和 ip4 端口。所以 docker swarm 不会创建监听端口 ip4。

    cat /etc/docker/daemon.json 
    
    {
      "experimental": true
    }
    

    netstat -antp

    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      657/sshd: /usr/sbin  
    tcp6       0      0 :::8000                 :::*                    LISTEN      3208/dockerd        
    tcp6       0      0 :::9443                 :::*                    LISTEN      3208/dockerd        
    tcp6       0      0 :::9000                 :::*                    LISTEN      3208/dockerd        
    tcp6       0      0 :::2377                 :::*                    LISTEN      3208/dockerd        
    tcp6       0      0 :::7946                 :::*                    LISTEN      3208/dockerd        
    tcp6       0      0 :::22                   :::*                    LISTEN      657/sshd: /usr/sbin 
    

    它像 ip6 一样 docker swarm init

    docker swarm init --advertise-addr=[]:2377

    如果 ipv4 在 worker 或 master 中启用,请帮我添加监听端口 ipv4+ipv6。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-30
      • 2021-08-10
      • 1970-01-01
      • 2015-04-11
      • 1970-01-01
      • 2022-06-14
      • 2012-03-03
      • 2017-04-09
      相关资源
      最近更新 更多