'Device or resource busy: after bind mount docker storage directory to NFS

When I specify docker directory to NFS(/data) following

https://www.ibm.com/docs/en/cloud-private/3.2.x?topic=pyci-specifying-default-docker-storage-directory-by-using-bind-mount

sudo rm -rf /var/lib/docker
sudo mkdir /var/lib/docker
sudo mkdir /data/docker
sudo mount --rbind /data/docker /var/lib/docker

Docker constantly causes problems as follows.

When I tring to install torch redundantly by dockerfile

Installing collected packages: torch, pillow, torchvision, torchaudio
  Attempting uninstall: torch
    Found existing installation: torch 1.9.0a0+c3d40fd
    Uninstalling torch-1.9.0a0+c3d40fd:
      Successfully uninstalled torch-1.9.0a0+c3d40fd
ERROR: Could not install packages due to an OSError: [Errno 16] Device or resource busy: 'Modules_CUDA_fix'

When I trying to use multiprocessing in docker container

  File "/root/anaconda3/envs/xi-tts-ml/lib/python3.8/multiprocessing/util.py", line 300, in _run_finalizers
    finalizer()
  File "/root/anaconda3/envs/xi-tts-ml/lib/python3.8/multiprocessing/util.py", line 224, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/root/anaconda3/envs/xi-tts-ml/lib/python3.8/multiprocessing/util.py", line 133, in _remove_temp_dir
    rmtree(tempdir)
  File "/root/anaconda3/envs/xi-tts-ml/lib/python3.8/shutil.py", line 718, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/root/anaconda3/envs/xi-tts-ml/lib/python3.8/shutil.py", line 675, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/root/anaconda3/envs/xi-tts-ml/lib/python3.8/shutil.py", line 673, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: '.nfs00000001c05e719f0004e474'

Is there a way to solve this without unmounting or disabling docker containers?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source