This post has been moved to: http://daniel-e.github.io/2014-12-26-permission-denied-for-lsof-in-docker/
On my host system I have installed Linux Mint 17 and on that host I’m running Docker with Ubuntu 17.10. Recently I wanted to call lsof in a Docker container and I got the following permission denied error:
root@ada77fe6ef60:/tmp# lsof -p 751 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME octave-cl 751 root cwd unknown /proc/751/cwd (readlink: Permission denied) octave-cl 751 root rtd unknown /proc/751/root (readlink: Permission denied) octave-cl 751 root txt unknown /proc/751/exe (readlink: Permission denied) octave-cl 751 root 0 unknown /proc/751/fd/0 (readlink: Permission denied) octave-cl 751 root 1 unknown /proc/751/fd/1 (readlink: Permission denied) octave-cl 751 root 2 unknown /proc/751/fd/2 (readlink: Permission denied)
I solved this problem simply by setting docker into complain mode on the host with the following command:
sudo aa-complain /etc/apparmor.d/docker