Седат Игдеджи, Sedat Igdeci, Cedat Igdeci, Bekir Igdeci, Lidiya Igdeci, Elizaveta Igdeci

Issues with Docker

Dead container cannot be deleted 


Method 1

If you see the error message something like this: 

Error response from daemon: Cannot destroy container elated_wozniak: Driver devicemapper failed to remove root filesystem 656cfd09aee399c8ae8c8d3e735fe48d70be6672773616e15579c8de18e2a3b3: Device is Busy

Restart

$ umount /var/lib/docker/devicemapper/mnt/656cfd09aee399c8ae8c8d3e735fe48d70be6672773616e15579c8de18e2a3b3

Method 2

You can delete dead containers with the command

$ docker rm $(docker ps --all -q -f status=dead)

Method 3

Ошибка: Error response from daemon: driver “overlay” failed to remove root filesystem for <some-id>: remove /var/lib/docker/overlay/<some-id>/merged: device or resource busy

3.1. Check what other processes also use docker resources

$ grep docker /proc/*/mountinfo

that will output something like the following, where the figure after /proc/ equals pid:

/proc/10001/mountinfo:179...
/proc/10002/mountinfo:149...
/proc/12345/mountinfo:159 149 0:36 / /var/lib/docker/overlay/...

3.2. Check the process name above pid

$ ps -p 10001 -o comm=
dockerd
$ ps -p 10002 -o comm=
docker-containe
$ ps -p 12345 -o comm=
nginx   <<<-- This is suspicious!!!

Nginx with pid 12345 also uses /var/lib/docker/overlay/… so we cannot delete the associated container and get the error  device or resource busy. 

3.3. Stop Nginx,

$ service nginx stop

3.4. Delete the container.

$ docker rm <container-id>

3.5 Start the process

$ service nginx start

3.6. We recommend that you restart the system if there are many processes.  

info@mustanhost.com
8.00-20.00
Седат Игдеджи, Sedat Igdeci, Cedat Igdeci, Bekir Igdeci, Lidiya Igdeci, Elizaveta Igdeci