Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out which capabilities a container has been given?

Tags:

docker

inspect

Say I run a container adding a capability, e.g. --cap-add=SYS_ADMIN

Is there a way to find out that this container has been assigned the SYS_ADMIN capability?

docker-inspect doesn't seem to return such information.

like image 404
Marcello Romani Avatar asked Apr 25 '17 22:04

Marcello Romani


People also ask

Which command is used to list all the container IDs?

To list Docker containers, use the docker container ls command or its alias docker ps .

What is Net_bind_service capability?

net_bind_service. This one's easy. If you have this capability, you can bind to privileged ports (e.g., those below 1024). If you want to bind to a port below 1024 you need this capability. If you are running a service that listens to a port above 1024 you should drop this capability.


1 Answers

You already answered your question, but to add another option: you might want to find the currently effective capabilities, regardless of which ones you have manually configured. https://github.com/riyazdf/dockercon-workshop/tree/master/capabilities mentions some utilities, which you would need to install inside the container. Example:

docker run --rm -it alpine sh -c 'apk add -U libcap; capsh --print'
like image 98
gesellix Avatar answered Nov 01 '22 12:11

gesellix