Forked from zenthangplus/fix-permission-docker-kill.sh
Created
March 12, 2022 13:48
-
-
Save ezracb/3ac8be1c4f7422d4cd4ac59b43a2de44 to your computer and use it in GitHub Desktop.
Fix permission denied when execute stop or kill docker containers on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Error example: | |
# ERROR: for redis cannot stop container: 16028f9: | |
# Cannot kill container 16028f9: unknown error after kill: docker-runc did not terminate sucessfully: | |
# container_linux.go:393: signaling init process caused "permission denied" | |
# | |
# This error was caused by AppArmor service in Ubuntu | |
# It was not working normally due to some unknown issues. | |
# Run following commands to fix it. | |
# Check AppArmor status | |
sudo aa-status | |
# Shutdown apparmor and prevent it from restarting | |
sudo systemctl disable apparmor.service --now | |
# Unload AppArmor profiles | |
sudo service apparmor teardown | |
# Re-check AppArmor status | |
sudo aa-status | |
# Try to re-stop containers | |
docker-compose down |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment