Docker Community Forums

Share and learn in the Docker community.

Capabilities on docker images?

Hi All,

Does anyone knows how to set the capabilities in a docker image. I’m having issues and not been able to set them

sudo setcap cap_net_raw=epi /usr/sbin/setcap
Failed to set capabilities on file `/usr/sbin/setcap’ (Operation not supported)
usage: setcap [-q] [-v] (-r|-|) [ … (-r|-|) ]

Note must be a regular (non-symlink) file.

capsh --print
Current: = cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+i
Bounding set =cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap

How can i accomplish this from dockerfile?

Does anyone have a solution to this?