docker runtime ai_generated true

Error response from daemon: cannot stop container: permission denied

ID: docker/cannot-stop-container

Also available as: JSON · Markdown
90%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
24 active

Root Cause

Docker cannot stop a container, often due to a zombie process or AppArmor/SELinux restriction.

generic

Workarounds

  1. 90% success Try docker kill <container> for a SIGKILL instead of SIGTERM
    docker stop sends SIGTERM; docker kill sends SIGKILL
  2. 85% success Check AppArmor/SELinux: dmesg | grep -i deny for policy blocks
    SELinux or AppArmor may prevent container signal delivery

    Sources: https://docs.docker.com/engine/security/apparmor/

Dead Ends

Common approaches that don't work:

  1. Using kill -9 on the container PID from the host 60% fail

    May leave Docker's state inconsistent; container appears running

  2. Rebooting the host 85% fail

    Disruptive to all running containers and services

Error Chain

Frequently confused with: