skip to Main Content

I tried this approach to create a Docker image out of a server. The server has an Nvidia 3070 GPU and runs AI models like this. The approach uses a Dockerfile to copy the whole system by COPY / / except what is specified in a .dockerignore file.

The reason for picking this approach is that, while running some older AI models, we observed that the outdated PyTorch versions and their dependencies are not kept around by Conda. As far as we looked, dependencies were not anywhere to be found.

Therefore, our best bet for the least amount of future trouble is to make a Docker image out of the whole Ubuntu server. Such a Docker image may give us infrastructure freedom in the future. Not a backup, but the essential parts we choose.

However, the above approach ran into space limitation error:

sudo docker build -t dockerHubUserName/mononphm:tag1 .
ERROR: failed to solve: write /var/lib/docker/overlay2/tkicrnyfr372xa7op3vapbpsx/diff/home/arisa/.conda/envs/tracker/lib/python3.9/site-packages/scipy/fftpack/tests/fftw_longdouble_ref.npz: no space left on device

Now, I’m trying to devise an alternative approach similar to the tried one. But rather than copying all folders and excluding a few, it will copy only the required/included folders.

I want to ensure that all the required dependencies by the AI model are included. The Nvidia/CUDA packages and tools too. What are the folders I have to include? Can someone help me with completing my list:

  • The home ~ folder along with all the visible and hidden subfolders.
    • Including the repository and all the separately downloaded binaries for it.
    • Including the configurations.
  • What folders for Conda?
  • What folders for Python?
    • PyTorch and all the other dependencies.
  • What folders are for CUDA and all its tools and dependencies?
  • Any other folder that might make a trouble in the future?

2

Answers


  1. Chosen as BEST ANSWER

    I'm going to try something like this based on that:

    FROM nvidia/cuda:12.3.1-devel-ubuntu22.04
    
    # Copy essential directories. What else is required?
    COPY /home/ /home/
    COPY /usr/local/ /usr/local/
    COPY /usr/lib/ /usr/lib/
    COPY /etc/ /etc/
    
    WORKDIR /home/
    
    CMD ["echo", "Run the model to see if everything is alright."]
    

  2. As commented by @Znerual this might be a solution to such a use case:

    https://en.wikipedia.org/wiki/Singularity_(software)

    Looks like its version 3.0.0 released by Sylabs is rewritten in Go. I’m going to give it a try…

    Using Singularity containers, developers can work in reproducible environments of their choosing and design, and these complete environments can easily be copied and executed on other platforms.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search