Cannot ping from within a container

when running ping I get the following…
is there any way to fix this?

root@b81d30abda6a:~# ping -c 1
ping: icmp open socket: Operation not permitted

It’s been a while since I tried this, I believe it has to do with these being unprivileged containers.

Do you get the same error with sudo?

We probably need some more context here. Are you running the ping with the Docker executor, and not in your own (Docker in Docker) container?

Also, what do you want to achieve with this? Containers have full access to contact the internet (to pull images and OS updates).

The command is already running as root, so that should not make a difference.

In any case, yes this has to do with the containers being unprivileged. Like @halfer, I also want to understand what the goal here is.

Actually on a deeper search, it looks like this is a random docker bug that has nothing to do with real permissions.

More reading here:

Interesting, not sure of what the best workaround is. In any case, I would still love to understand the use case :slight_smile: … if it’s just “I want to use ping” that’s totally cool, but you may not be able to with our default base images which are based on debian and seem to have this bug upstream.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.