I am trying to apply the following simple AppArmor profile:
#include <tunables/global>
profile docker-profile flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
#network,
#capability,
#file,
#umount,
#ptrace,
#mount,
pivot_root,
}
When I run docker run -it --rm --security-opt apparmor=docker-profile alpine
I get the following error:
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:359: container init caused \\"apparmor failed to apply profile: no such file or directory\\"\"\n".
I tried to reinstall it (based on suggestions here):
rm -rf /etc/apparmor*
apt install apparmor --reinstall
service apparmor restart
service docker restart
It didn't help, I am still getting the same error.
Any suggestion what can be the reason and how to solve it ?
sudo modprobe apparmor
. But for some reason systemctl tried to run AppArmor service, which failed, you can check it by runningsudo systemctl status apparmor
. I tried various ways to fix that, but nothing worked. Eventually I ended up with reinstall OS to Debian 11. AppArmor module still wasn't installed, but systemctl didn't tried to execute it and Docker has worked. – Tiloine