I'm having a particular issue with a runc container. I have a bash script (running as root) that's executing the following:
$ setcap cap_net_bind_service=+ep ${PACKAGE_DIR}/bin/my-binary
$ chpst -u vcap:vcap "${PACKAGE_DIR}/bin/my-binary" --config "${JOB_DIR}/config/config.json"
every time, when it runs at container start it fails with this output:
5116 Segmentation fault chpst -u vcap:vcap "${PACKAGE_DIR}/bin/my-binary" --config "${JOB_DIR}/config/config.json"
However:
- When I ssh or shell into the container and run the command by hand, it will work.
- If I remove the
chpst -u vcap:vcap
(run as root) it will also work. - If I remove the
setcap cap_net_bind_servic...
declaration, it will also work. - When I change chown
my-binary
tovcap:vcap
, it will work.
But none of these are valid options for the real implementation. I've even edited the source code of the binary to simply sleep for 2 hours - which had no effect, so I don't think the actual source code of the binary is the cause. Is there something I'm missing?
My runc version is:
runc version 1.0.0-rc5+dev
commit: 69663f0bd4b60df09991c08812a60108003fa340
spec: 1.0.0
The missing piece of the puzzle was these bit of logs here:
I don't know why but the fix for my problem was to add
vsyscall=emulate
to the kernel command line arguments that I was using.