docker缩小镜像大小的六种方法
dnsmasq在docker中无应答

docker容器中不能ping

妙音 posted @ 2018年6月10日 06:40 in docker , 12006 阅读
  • 描述
进入容器内,执行ping命令,提示缺少权限
docker exec -it deac /bin/bash
bash-4.3$ ping 192.168.1.100
PING 192.168.1.100 (192.168.10.100): 56 data bytes
ping: permission denied (are you root?)
 
  • 首先,查看当前用户
bash-4.3$ whoami
jenkins
 
  • 然后,再看看文件权限
缺少权限创建socket
# 查看ping权限
bash-4.3# ls -lsh /bin/ping
0 lrwxrwxrwx 1 root root 12 May  9  2017 /bin/ping -> /bin/busybox

#查看ping连接文件的权限
bash-4.3$ ls -lhs /bin/busybox
804K -rwr-xr-x 1 root root 803K Oct 26  2016 /bin/busybox
 
  • 方法一,临时方式,以root用户登录
docker exec -u root -it deac /bin/bash
 
  • 方法二,永久,添加s权限
#添加权限
chmod u+s /bin/ping  # 让用户在执行ping时,暂时拥有权限

#再查看权限
bash-4.3$ ls -lsh /bin/busybox
804K -rwsr-xr-x 1 root root 803K Oct 26  2016 /bin/busybox
 
此生必看的科学实验-水知道答案

 

Avatar_small
dolly 说:
2020年10月08日 18:36

<a href="http://maps.google.li/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.lk/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.co.ls/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.lt/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.lu/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.lv/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.com.ly/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.mg/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.mk/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.ml/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.com.mm/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.mn/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.ms/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.com.mt/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>
<a href="http://maps.google.mu/url?q=https%3A%2F%2Fcricketlive.live ">cricketlive.live </a>

Avatar_small
Mumbai escorts 说:
2020年10月21日 14:59

Its a great pleasure reading your post. Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.

Avatar_small
Services ManMa 说:
2023年6月15日 17:22

<a href="https://manmaservices.com/">Business consultant in India</a>:- We at ManMa services, offer comprehensive solutions for your business needs. For all of your business needs, our platform offers comprehensive solutions! We are thrilled to introduce our newest vertical, which gives companies a special opportunity to prosper with us. We typically provide a convenient and efficient way for our clients to reach the service providers of their choice & requirement.

Avatar_small
Personalised Gifts f 说:
2023年6月16日 04:47

I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... Personalised Gifts for Dad

Avatar_small
Used tyres Maidstone 说:
2023年6月16日 22:22

Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our.Used tyres Maidstone

Avatar_small
Brake Disc replaceme 说:
2023年6月17日 06:58

Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. Brake Disc replacement Worthing

Avatar_small
suspension repair Bo 说:
2023年6月18日 06:26

I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious... suspension repair Boughton Monchelsea

Avatar_small
must haves for skin 说:
2023年6月22日 21:09

You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. must haves for skin care routine

Avatar_small
kyle griffin 说:
2023年6月24日 02:57

I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. kyle griffin

Avatar_small
patrick way 说:
2023年6月24日 21:52

Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. patrick way

Avatar_small
dpf Clean Maidstone 说:
2023年6月30日 05:56

Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. dpf Clean Maidstone

Avatar_small
Wheel Tracking Worth 说:
2023年6月30日 07:10

I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. Wheel Tracking Worthing

Avatar_small
surprise for father' 说:
2023年7月01日 00:40

A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. surprise for father's day

Avatar_small
Car servicing Maidst 说:
2023年7月10日 00:25

I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject.Car servicing Maidstone

Avatar_small
INSTANT MOT Farnham 说:
2023年7月11日 09:56

Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign. INSTANT MOT Farnham

Avatar_small
MOT Service Aldersho 说:
2023年7月13日 09:09

i never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. MOT Service Aldershot

Avatar_small
full service Aylesfo 说:
2023年7月13日 12:12

Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. full service Aylesford

Avatar_small
CheatsHouse 说:
2023年8月01日 19:04 CheatsHouse is awesome, discover the finest cheats of the highest quality here, especially for GTA
Avatar_small
new tyres Farnham 说:
2023年9月16日 13:20 This particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs…new tyres Farnham
Avatar_small
Brake Pads in London 说:
2023年9月28日 01:41

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Brake Pads in London

Avatar_small
INSTANT MOT Farnham 说:
2023年10月03日 01:19

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. INSTANT MOT Farnham

Avatar_small
SEO Company in the U 说:
2023年10月30日 01:29

Your writing style is so captivating. I couldn't stop reading once I started. SEO Company in the UK

Avatar_small
clutch replacement A 说:
2023年11月04日 03:32

"I appreciate the effort put into creating a helpful 'How It Works' section on your website." clutch replacement Aylesford


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter