美文网首页
009_Docker运行ubuntu容器无ifconfig和pi

009_Docker运行ubuntu容器无ifconfig和pi

作者: AI秘籍 | 来源:发表于2022-01-27 11:29 被阅读0次

    Doker提供的ubuntu镜像非常干净,大小只有63.1MB,没有常见的一些基本库。

    image.png

    进入ubuntu容器中查找不到ifconfig,ping,vim等基本命令。

    test01@test:~$ docker run -it --name version1 ubuntu:18.04 /bin/bash

    root@e63d89aab255:/# ifconfig

    bash: ifconfig: command not found

    root@e63d89aab255:/# ping www.baidu.com

    bash: ping: command not found

    root@e63d89aab255:/# ^C

    root@e63d89aab255:/# vim

    bash: vim: command not found

    root@e63d89aab255:/#

    image.png

    通过apt-get命令进行安装。

    root@e63d89aab255:/# apt-get update

    root@e63d89aab255:/# apt install net-tools 安装ifconfig

    root@e63d89aab255:/# apt install iputils-ping 安装ping

    image.png image.png image.png

    【注】:

    net-tools包含:arp, ifconfig, netstat, rarp , nameif, route这几个工具。

    测试是否成功

    root@e63d89aab255:/# ifconfig

    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

        inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
    
        ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
    
        RX packets 12363  bytes 25090342 (25.0 MB)
    
        RX errors 0  dropped 0  overruns 0  frame 0
    
        TX packets 8626  bytes 473222 (473.2 KB)
    
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    

    lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0
    
        loop  txqueuelen 1000  (Local Loopback)
    
        RX packets 0  bytes 0 (0.0 B)
    
        RX errors 0  dropped 0  overruns 0  frame 0
    
        TX packets 0  bytes 0 (0.0 B)
    
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    image.png

    原文链接:
    Docker运行ubuntu容器无ifconfig和ping等命令 - 知乎 (zhihu.com)
    Docker运行ubuntu容器无ifconfig和ping等命令 (qq.com)

    相关文章

      网友评论

          本文标题:009_Docker运行ubuntu容器无ifconfig和pi

          本文链接:https://www.haomeiwen.com/subject/aujuhrtx.html