Home > Operation and Maintenance > Docker > What to do if the docker container cannot be stopped

What to do if the docker container cannot be stopped

王林
Release: 2020-04-14 10:38:11
Original
6296 people have browsed it

What to do if the docker container cannot be stopped

(1) Executing the delete command cannot delete the docker directory:

# ll /var/lib/docker/containers | grep caf8ef20f3c1
# cd /var/lib/docker/containers 
# rm -rf caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8
Copy after login

At this time we will receive such an error:

rm: 无法删除"/var/lib/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets": 设备或资源忙
    无法删除"/var/lib/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm": 设备或资源忙
Copy after login

(2 ) From the above error report, we can see that the "secrets" and "shm" shared mounts cannot be deleted. First find the mount location, then cancel the mount, and then delete it:

# cat /proc/mounts |grep "docker" |grep "caf8ef20f3c1"
Copy after login

(3) Cancel the mount Load:

# umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets
# umount /data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm
Copy after login

(4) View again:

# cat /proc/mounts |grep "docker" |grep "caf8ef20f3c1"  //已经没有啦
Copy after login

(5) Now delete the docker directory:

# cd /var/lib/docker/containers 
# rm -rf caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8
Copy after login

(6) Delete the container service

Now we use rm or kill to delete the container service:

# docker rm -f caf8ef20f3c1c
#或
# docker kill --signal=SIGINT  caf8ef20f3c1
Copy after login

If hang occurs after running the above command, please restart the docker service:

# systemctl restart docker
Copy after login

Complete the above steps , the problems encountered can basically be solved.

Recommended tutorial: docker tutorial

The above is the detailed content of What to do if the docker container cannot be stopped. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template