I am trying to put a script into a docker container that requires access to /dev/mem. I am running into an issue because I cannot control how the docker image is run, basically in production I do not have the ability to add --privileged but that’s one of the only ways I have gotten the container to work as expected.
I have also had success running the container with --cap-add SYS_RAWIO --device /dev/mem:/dev/mem. This is probably a slightly better solution as its not giving the container complete privileged access to the host, however I have the same problem when deploying the container. I cannot add any flags/arguments before the container name.
Does anyone have a possible workaround? Any advice/help would be much appreciated!
Test Host OS’s: Ubuntu 16.04 Desktop, Liunux Mint 19.1, Ubuntu 18 Desktop
Docker version 19.03.6, build 369ce74a3c