Docker error - cannot remove a container
This is a known issue being worked on by docker. I'd recommend upgrading to a newer kernel (the 7.4 centos equivalent is a large improvement) and migrating to overlay2. Once the 18.03 release comes out, I'd recommend upgrading since some of the fixes from the docker side will be included there.
When deleting containers causes this issue, you can try the force option (docker rm -f
), which will often still report the error but ultimately remove the container after a few seconds. You'll likely have some leftover pieces that would be best cleaned up by a reboot, but it may help workaround any other issues the filesystem locking problem is causing.
One other thing I've seen improve docker on RH and CentOS systems is to make a file with:
$ cat /etc/systemd/system/docker.service.d/override.conf
[Service]
MountFlags=slave
This should now be the default in current releases of docker, but you may have copied your unit file from an older version that didn't have it. To apply that file, you'll need to systemctl daemon-reload && systemctl restart docker
as root.