问题
I am having trouble removing dead containers. When I try to remove container I get:
$ docker rm -f d1dd3082f7bb
Error response from daemon: Unable to remove filesystem for d1dd3082f7bbfc2310e497d0af47d51a8ca4e6e90a0d565a85d033f96a12325f: remove /var/lib/docker/containers/d1dd3082f7bbfc2310e497d0af47d51a8ca4e6e90a0d565a85d033f96a12325f/shm: device or resource busy
Have never encountered such problem before. Some information about current setup:
$ uname -a
Linux AUIS1 3.16.6-2-default #1 SMP Mon Oct 20 13:47:22 UTC 2014 (feb42ea) x86_64 x86_64 x86_64 GNU/Linux
$ docker info
Containers: 19
Running: 15
Paused: 0
Stopped: 4
Images: 19
Server Version: 1.12.1
Storage Driver: btrfs
Build Version: Btrfs v3.16+20140829
Library Version: 101
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: overlay bridge null host
Swarm: inactive
Runtimes: oci runc
Default Runtime: oci
Security Options: apparmor
Kernel Version: 3.16.6-2-default
Operating System: openSUSE 13.2 (Harlequin) (x86_64)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.66 GiB
Name: AUIS1
ID: PPHC:6VP2:PWW4:2JLX:I2UI:FZ3M:LWEQ:ZR6H:RV2K:HWRQ:VUCD:OPUH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
WARNING: No kernel memory limit support
Cluster Store: consul://10.10.1.7:8500
Cluster Advertise: 10.10.1.7:2375
Insecure Registries:
127.0.0.0/8
How can I safely remove them?
Forgot to mention that these containers are managed by docker swarm and compose.
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4a1193af7710 6ca7469301cb "/bin/sh -c 'exec jav" 5 days ago Dead 4a1193af7710_4a1193af7710_4a1193af7710_xxxxxx2
f0446365fb75 e56d2658c291 "/bin/sh -c 'exec jav" 5 days ago Dead f0446365fb75_f0446365fb75_f0446365fb75_f0446365fb75_xxxxx1
243e27c2cdf3 50e38ce0458f "docker-entrypoint.sh" 6 days ago Dead 243e27c2cdf3_243e27c2cdf3_243e27c2cdf3_redis
Adding docker inspect of dead container, inspect output
$ docker inspect 4a1193af7710
回答1:
grep d1dd3082f7bbfc2310e497d0af47d51a8ca4e6e90a0d565a85d033f96a12325f /proc/*/mountinfo
then find the pid of d1dd3082f7bbfc2310e497d0af47d51a8ca4e6e90a0d565a85d033f96a12325f
and kill it
来源:https://stackoverflow.com/questions/39485099/cannot-remove-dead-docker-containers-storage-driver-btrfs