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

Apr 14, 2020 am 10:38 AM
docker

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to choose Hadoop version in Debian How to choose Hadoop version in Debian Apr 13, 2025 am 11:48 AM

When choosing a Hadoop version suitable for Debian system, the following key factors need to be considered: 1. Stability and long-term support: For users who pursue stability and security, it is recommended to choose a Debian stable version, such as Debian11 (Bullseye). This version has been fully tested and has a support cycle of up to five years, which can ensure the stable operation of the system. 2. Package update speed: If you need to use the latest Hadoop features and features, you can consider Debian's unstable version (Sid). However, it should be noted that unstable versions may have compatibility issues and stability risks. 3. Community support and resources: Debian has huge community support, which can provide rich documentation and

Docker on Linux: Best Practices and Tips Docker on Linux: Best Practices and Tips Apr 13, 2025 am 12:15 AM

Best practices for using Docker on Linux include: 1. Create and run containers using dockerrun commands, 2. Use DockerCompose to manage multi-container applications, 3. Regularly clean unused images and containers, 4. Use multi-stage construction to optimize image size, 5. Limit container resource usage to improve security, and 6. Follow Dockerfile best practices to improve readability and maintenance. These practices can help users use Docker efficiently, avoid common problems and optimize containerized applications.

How to integrate GitLab with other tools in Debian How to integrate GitLab with other tools in Debian Apr 13, 2025 am 10:12 AM

Integrating GitLab with other tools in Debian can be achieved through the following steps: Install the GitLab update system package: sudoapt-getupdate Install dependencies: sudoapt-getinstall-ycurlopenssh-serverca-certificatestzdataperl Add GitLab official repository: curlhttps://packages.gitlab.co

Discussion on the log rotation strategy of Debian Node.js Discussion on the log rotation strategy of Debian Node.js Apr 12, 2025 pm 09:03 PM

This article discusses the log rotation strategy for running Node.js applications in Debian systems, aiming to effectively manage the size and quantity of log files, avoid excessive disk space, and simplify the log archiving and analysis process. Log Rotation Method utilizes Node.js log library: Many popular Node.js log libraries (such as Winston, Bunyan, and Pino) ​​have built-in log Rotation functionality, which can be easily implemented through configuration. For example, the RotatingFileHandler of the Winston library can set the log file size and quantity limits. Configuration file example (Winston):constwinston=require('wi

Detailed explanation of docker principle Detailed explanation of docker principle Apr 14, 2025 pm 11:57 PM

Docker uses Linux kernel features to provide an efficient and isolated application running environment. Its working principle is as follows: 1. The mirror is used as a read-only template, which contains everything you need to run the application; 2. The Union File System (UnionFS) stacks multiple file systems, only storing the differences, saving space and speeding up; 3. The daemon manages the mirrors and containers, and the client uses them for interaction; 4. Namespaces and cgroups implement container isolation and resource limitations; 5. Multiple network modes support container interconnection. Only by understanding these core concepts can you better utilize Docker.

Linux Containers: The Foundation of Docker Linux Containers: The Foundation of Docker Apr 14, 2025 am 12:14 AM

LXC is the foundation of Docker, and it realizes resource and environment isolation through cgroups and namespaces of the Linux kernel. 1) Resource isolation: cgroups limit CPU, memory and other resources. 2) Environment isolation: namespaces provides independent process, network, and file system views.

What is the CentOS MongoDB backup strategy? What is the CentOS MongoDB backup strategy? Apr 14, 2025 pm 04:51 PM

Detailed explanation of MongoDB efficient backup strategy under CentOS system This article will introduce in detail the various strategies for implementing MongoDB backup on CentOS system to ensure data security and business continuity. We will cover manual backups, timed backups, automated script backups, and backup methods in Docker container environments, and provide best practices for backup file management. Manual backup: Use the mongodump command to perform manual full backup, for example: mongodump-hlocalhost:27017-u username-p password-d database name-o/backup directory This command will export the data and metadata of the specified database to the specified backup directory.

How to upgrade GitLab version of Debian system How to upgrade GitLab version of Debian system Apr 13, 2025 am 09:48 AM

Upgrading the GitLab version on the Debian system can follow the following steps: Method 1: Use the upgrade script provided by GitLab to back up the data. Before any upgrade, please make sure that you back up all important data of GitLab, including repositories, configuration files and databases. Download the latest version of GitLab and visit the official GitLab website to find the latest version suitable for your system, and download the corresponding installation package. Stop GitLab service sudogitlab-ctlstopunicorn

See all articles