I'd like to run the Nmap tool in a Docker container but not with the default root user account. I already set the (hopefully) right capabilities via setcap. Unfortunately, I get only the "operation not permitted" error when I try to run it.
This is my docker file:
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
RUN microdnf install nmap which
RUN setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip $(which nmap)
USER 1001
CMD ["nmap", "--privileged", "-sU", "localhost"]
Any idea on how to fix this?