"Could not check if docker-default AppArmor profile was loaded: open /sys/kernel/security/apparmor/profiles: permission denied"

I’m attempting to get an LXC container of Ubuntu 18.04 to run a Dockerized Discourse instance, but am hitting a wall as per my documentation here. This is the error:

/usr/bin/docker: Error response from daemon: Could not check if docker-default AppArmor profile was loaded: open /sys/kernel/security/apparmor/profiles: permission denied.
Your Docker installation is not working correctly

What should I do to address this issue with AppArmor?

You’ll need to look up apparmor namespacing and set that up.
LXD does it for you but on LXC, I think you’re mostly on your own, so would need to manually create the namespace and then specify it with lxc.apparmor.profile using the weird namespace syntax used by apparmor.

@stgraber

This problem exists today in Ubuntu 20.04 and SNAP LXD v4.2:

“Could not check if docker-default AppArmor profile was loaded: open /sys/kernel/security/apparmor/profiles: permission denied”

I’ve been encountering it also recently.

If you want to run docker inside lxc container, enable security.nesting and than install latest docker-ce.

Docker from my distribution (debian bullseye) was not working (problems with apparmor etc)