【问题标题】:Ping: command not found when using hyperledger fabric imagePing:使用超级账本结构图像时找不到命令
【发布时间】:2020-10-28 21:12:29
【问题描述】:

我是 docker 初学者,如有错误请指正。

如本 docker swarm 教程 https://www.youtube.com/watch?v=nGSNULpHHZc 所示,我正在尝试为我的超级账本结构应用程序设置多主机设置。

我正在使用两台 oracle linux 服务器,即服务器 1 和服务器 2。 我使用 docker swarm 作为管理器连接了两台服务器,并创建了名为 my-net 的覆盖网络。

我遵循上述教程中给出的相同语法,并使用下面提到的语法创建了服务。

docker service create --name myservice --network my-net --replicas 2 alpine sleep 1d

正如预期的那样,它在每个服务器中创建了一个 conatiner。 例如,服务器 1 容器 IP 为 10.0.0.4,服务器 2 容器 IP 为 10.0.0.5。 现在,我正在尝试从第二个服务器容器 ping 到第一个服务器的容器,如下所示,它正在 ping。

# docker exec -it ContainerID sh
/#ping 10.0.0.4
PING 10.0.0.4 (10.0.0.4):56 个数据字节
来自 10.0.0.4 的 64 个字节:seq=0 ttl=64 time=0.082 ms
来自 10.0.0.4 的 64 个字节:seq=1 ttl=64 time=0.062 ms
来自 10.0.0.4 的 64 个字节:seq=2 ttl=64 time=0.067 ms
^C
--- 10.0.0.4 ping 统计 ---
发送 3 个数据包,接收 3 个数据包,0% 数据包丢失
往返最小/平均/最大 = 0.062/0.070/0.082 毫秒

现在,我正在尝试使用下面提到的语法创建我的服务 (1)。

docker service create --name myservice1 --network my-net --replicas 2 hyperledger/fabric-peer sleep 1d

正如预期的那样,这也在每个服务器中创建了一个 conatianer。 例如,服务器 1 容器 IP 为 10.0.0.6,服务器 2 容器 IP 为 10.0.0.7。 现在,我正在尝试从第二个服务器容器 ping 到第一个服务器的容器,如下所示。 这次我收到 ping not found 错误,
# docker exec -it ContainerID sh
# ping 10.0.0.6
sh: 1: ping: 未找到

谁能帮忙看看第二个myservice1有什么问题。

【问题讨论】:

    标签: docker hyperledger-fabric hyperledger docker-swarm


    【解决方案1】:

    Fabric Docker 映像基于基本的 Ubuntu 映像,不包含 ping 等实用程序。一旦你“执行”到对等容器中,你就可以使用“apt”来安装 ping:

    apt-get update
    apt-get install inetutils-ping
    

    在末尾添加-ping

    【讨论】:

    • 感谢@gari Singh。我使用了 apt-get install iputils-ping 来安装 ping。安装后,我可以从一台机器容器 ping 到另一台机器容器。
    【解决方案2】:

    扩展 Gari Singh 的回答,在我本周创建的 Fabric 网络上,inetutils 已拆分为不同的包:

    # apt-cache search inetutils
    inetutils-ftp - File Transfer Protocol client
    inetutils-ftpd - File Transfer Protocol server
    inetutils-inetd - internet super server
    inetutils-ping - ICMP echo tool
    inetutils-syslogd - system logging daemon
    inetutils-talk - talk to another user
    inetutils-talkd - remote user communication server
    inetutils-telnet - telnet client
    inetutils-telnetd - telnet server
    inetutils-tools - base networking utilities (experimental pac
    

    所以安装例如ping正确的命令变成了:

    # apt-get install inetutils-ping
    

    peer的Ubuntu版本是:

    # cat /etc/lsb-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=16.04
    DISTRIB_CODENAME=xenial
    DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"
    
    
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-23
      • 1970-01-01
      • 2021-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-31
      相关资源
      最近更新 更多