docker on ubuntu 16.04 error when killing container
For me removing the unknown from AppArmor works:
sudo aa-remove-unknown
AppArmor (Application Armor) is a Linux security module that protects an operating system and its applications from security threats. To use it, a system administrator associates an AppArmor security profile with each program. Docker expects to find an AppArmor policy loaded and enforced. Check default profiles with:
# sudo apparmor_status
To use docker default profile on a container, run:
$ docker run --rm -it --name test-container --security-opt apparmor=docker-default image-name
You disable it using the commands:
--security-opt apparmor=unconfined
With the docker run commands.
To disable apparmor service, use:
# systemctl stop apparmor && systemctl disable apparmor
For Ubuntu 14. Use:
# service apparmor stop
# update-rc.d -f apparmor remove
It’s recommended to set working profiles for Docker apparmor than disabling it, especially for production setups.
Check this awesome google document on Securing Containers with AppArmor.
https://cloud.google.com/container-optimized-os/docs/how-to/secure-apparmor
This command will stop all docker containers.
sudo killall docker-containerd-shim
This command will remove all docker containers.
sudo docker-compose down