Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that container service cannot be stopped or deleted in Docker

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to solve the problem that container service cannot be stopped or deleted in Docker". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem that container service cannot be stopped or deleted in Docker".

Operation steps

(1) the directory of docker cannot be deleted by executing the delete command:

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

At this time, we will receive an error like this:

Rm: cannot delete "/ var/lib/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets": device or resource busy cannot delete "/ var/lib/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm": device or resource is busy

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

# cat / proc/mounts | grep "docker" | grep "caf8ef20f3c1"

(3) unmount:

# umount / data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/secrets# umount / data/sys/var/docker/containers/caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8/shm

(4) check again:

# cat / proc/mounts | grep "docker" | grep "caf8ef20f3c1" / / is no longer available

(5) now delete the directory of docker:

# cd / var/lib/docker/containers # rm-rf caf8ef20f3c1c78f03a5844ee23abc1d7e44246f242292040f1ef288899d0cb8

(6) Delete CCS

Now let's use rm or kill to delete the container service:

# docker rm-f caf8ef20f3c1c or # docker kill-- signal=SIGINT caf8ef20f3c1

If hang is stuck (stuck) after the above command is run, restart the docker service:

# systemctl restart docker Thank you for your reading. The above is the content of "how to solve the problem of container service that cannot be stopped or deleted in Docker". After the study of this article, I believe you have a deeper understanding of how to solve the problem of container service cannot be stopped or deleted in Docker, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report