Search code examples
pythondockerdocker-composecontainers

Moved docker dir to /home, /tmp directory error


For reasons of space on / I have moved the directory / var / lib / docker to my home. Containers work fine, I can create new ones and manage everything as usual. But there is a problem with a framework, it gives me this error

 File "/usr/lib/python3.5/tempfile.py", line 474, in mkstemp
    prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
  File "/usr/lib/python3.5/tempfile.py", line 269, in _sanitize_params
    dir = gettempdir()
  File "/usr/lib/python3.5/tempfile.py", line 435, in gettempdir
    tempdir = _get_default_tempdir()
  File "/usr/lib/python3.5/tempfile.py", line 370, in _get_default_tempdir
    dirlist)
FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']

I checked inside the container and see the / tmp directory at 0%. I also tried changing directory permissions, but to no avail. I tried running docker-compose up --build

Could you help me?

Docker ver: Docker version 20.10.2, build 2291f61

Docker compose ver: docker-compose version 1.27.4, build unknown

OS: Fedora 33


Solution

  • I have added to my Dockerfile this

    RUN chmod 777 -R /tmp && chmod o+t -R /tmp
    

    Works!!