Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AmreeshTyagi/8e6c1a920a77b62db341fd28e8045088 to your computer and use it in GitHub Desktop.
Save AmreeshTyagi/8e6c1a920a77b62db341fd28e8045088 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Make this file executable and run with sudo
# chmod +x ./fix-docker-desktop-apparmor-allow-ubuntu-24.04.sh
# sudo ./fix-docker-desktop-apparmor-allow-ubuntu-24.04.sh
#
# References https://github.com/docker/docs/issues/20383#issue-2397592123
# https://askubuntu.com/questions/1511725/ubuntu-24-04-docker-desktop-is-not-starting/1519662#1519662
echo "Creating AppArmor profile to allow docker desktop"
cat > /etc/apparmor.d/opt.docker-desktop.bin.com.docker.backend << EOF
abi <abi/4.0>,
include <tunables/global>
/opt/docker-desktop/bin/com.docker.backend flags=(default_allow) {
userns,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/opt.docker-desktop.bin.com.docker.backend>
}
EOF
echo "AppArmor profile created"
echo "Restarting AppArmor service"
systemctl restart apparmor.service
echo "AppArmor service restarted"
echo "Try to start Docker desktop now !!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment