简体   繁体   中英

ping: socket: Operation not permitted Ubuntu docker image

Hi i am new to docker and linux. I am trying to ping a particular ip address from a python file in a container built on ubuntu 18.04 base.

I get the following error when the container is ran on CentOS OS but it runs fine on Ubuntu OS

Error when container is ran on CentOS OS

Ping runs fine when container is ran on Ubuntu OS

The output for ls -lsa, sudo ping

Any help would be appreciated. Thanks!

The error sounds more like an access privilege issue and less like a network issue. I'd problem solve by checking user prividges, to start can you ping CentOS using sudo and check the binary permissions.

which ping
ls -lsa /bin/ping

I'd expect the middle section to contain an x (for execute), eg something like -rwxr-xr-x

and/or use sudo to confirm it's priviledge related:

sudo ping 192.168.92.166

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM