docker - 如何在 Fedora Docker 上使用“ping”
问题描述
在容器根/
目录中,我键入
ping
并得到
bash: ping: command not found
然后我输入
yum install iputils
然后我输入
ping
我得到
bash: /usr/bin/ping: Operation not permitted
然后我做
sudo ping
我得到
bash: sudo: command not found
所以我输入
yum install sudo
我输入
sudo ping
我得到
sudo: unable to execute /bin/ping: Operation not permitted
在这一点上,我放弃了,把手举在空中......
那么我该如何使用ping
util,并且我还想使用其他 utils,例如hostname
和ifconfig
解决方案
它适用于最新的 Fedora
$ docker run -it fedora /bin/bash
Unable to find image 'fedora:latest' locally
latest: Pulling from library/fedora
01eb078129a0: Pull complete
Digest: sha256:8ee55e140e8751492ab2cfa4513c82093cd2716df9311ea6f442f1f1259cbb3e
Status: Downloaded newer image for fedora:latest
[root@5eee4a163a0e /]# pwd
/
[root@5eee4a163a0e /]# ping
bash: ping: command not found
[root@5eee4a163a0e /]# yum install iputils
Fedora Modular 29 - x86_64 349 kB/s | 1.5 MB 00:04
Fedora Modular 29 - x86_64 - Updates 291 kB/s | 2.1 MB 00:07
Fedora 29 - x86_64 - Updates 4.3 MB/s | 25 MB 00:05
Fedora 29 - x86_64 5.0 MB/s | 62 MB 00:12
Dependencies resolved.
============================================================================================================================================================================================================
Package Architecture Version Repository Size
============================================================================================================================================================================================================
Installing:
iputils x86_64 20180629-2.fc29 fedora 130 k
Transaction Summary
============================================================================================================================================================================================================
Install 1 Package
Total download size: 130 k
Installed size: 334 k
Is this ok [y/N]: y
Downloading Packages:
iputils-20180629-2.fc29.x86_64.rpm 84 kB/s | 130 kB 00:01
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 45 kB/s | 130 kB 00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : iputils-20180629-2.fc29.x86_64 1/1
Running scriptlet: iputils-20180629-2.fc29.x86_64 1/1
Verifying : iputils-20180629-2.fc29.x86_64 1/1
Installed:
iputils-20180629-2.fc29.x86_64
Complete!
[root@5eee4a163a0e /]# ping
Usage: ping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface]
[-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos]
[-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option]
[-w deadline] [-W timeout] [hop1 ...] destination
Usage: ping -6 [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface]
[-l preload] [-m mark] [-M pmtudisc_option]
[-N nodeinfo_option] [-p pattern] [-Q tclass] [-s packetsize]
[-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline]
[-W timeout] destination
[root@5eee4a163a0e /]#
推荐阅读
- javascript - 将内容下移到固定位置标题后面
- php - 如何过滤数组php
- javascript - 为什么我在网站上上传时我的 jQuery 不起作用
- javascript - 在 pentaho 或 Javascript 中每行添加 2 分钟
- sql - 如何创建具有对象类型的表?
- web-scraping - 如何阻止爬虫
- dns - 如何在浏览器中不显示目标 URL 的情况下将域转发到 Cloudfront URL?
- python - 循环访问 API json 响应并将它们添加到一个 python 字典中
- python - 我将如何遍历数据框并创建一个将列名存储为键并将相应的行索引存储为值的字典?
- react-redux - redux test Actions 必须是普通对象。使用自定义中间件进行异步操作