Problem
I am building a Docker container (based on RHEL) that includes a custom binary from a third-party repository. When executing the binary in the container, I receive a nondescript error: "Operation not permitted".
Analysis
Dockerfile
The Dockerfile is fairly simple.
FROM dockerregistry.example.com/rhel7:latest
RUN yum -y install \
curl \
custom-package && \
curl -Lsq https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 > /sbin/dumb-init && \
chmod 755 /sbin/dumb-init && \
yum clean all
ADD custom-package.conf /etc/custom-package/custom-package.conf
ENTRYPOINT ["/sbin/dumb-init", "--"]
CMD ["/usr/local/custom-package/bin/custom-package", "--config", "/etc/custom-package/custom-package.conf"]
Building the image
I build and enter the container on my workstation using the following commands.
$ docker build -t custom-package:v1 .
$ docker run --security-opt seccomp:unconfined -d custom-package:v1 tail -f /dev/null
$ docker exec -it <image ID> /bin/bash
"Operation not permitted"
Once I'm inside the image, if I try executing the binary, I receive an extremely unhelpful error. Running strace also gives a confusing output. On inspecting file permissions and metadata, it appears to be fine.
# /usr/local/telegraf/bin/telegraf
bash: /usr/local/telegraf/bin/telegraf: Operation not permitted
# strace -f /usr/local/telegraf/bin/telegraf
execve("/usr/local/telegraf/bin/telegraf", ["/usr/local/telegraf/bin/telegraf"], [/* 17 vars */]) = -1 EPERM (Operation not permitted)
write(2, "strace: exec: Operation not perm"..., 38strace: exec: Operation not permitted
) = 38
exit_group(1) = ?
+++ exited with 1 +++
# ls -l /usr/local/telegraf/bin/telegraf
-rwxr-xr-x 1 telegraf telegraf 38664736 Jun 3 15:41 /usr/local/telegraf/bin/telegraf
# getcap -v /usr/local/telegraf/bin/telegraf
/usr/local/telegraf/bin/telegraf = cap_sys_rawio+ep
I am unable to collect enough information to debug my container and why the executable binary isn't working. Is there something that stands out as wrong or a reason why I would receive an unhelpful error like this?
Thanks!