R
RunPod3mo ago
ohno

Mounting network volume into serverless Docker container

Hi everyone, I am trying to deploy a FastAPI app in a Docker container hosted on a serverless RunPod. My issue is: I need to pass a very large data folder to the Docker container. I could easily do this on a Pod by using the following Container Start Command:
docker run -it -p 8080:8080 -v "$(shell cd /workspace; pwd)":/opt/data my_image:latest
docker run -it -p 8080:8080 -v "$(shell cd /workspace; pwd)":/opt/data my_image:latest
However, I simply can't get it to work with a serverless deployment. I know the network volume is mounted at /runpod-volume rather than /workspace for serverless. But even by adjusting my Docker run command, I just can't get it to show up inside my container:
docker run -it -p 8080:8080 -v /runpod-volume:/opt/data my_image:latest
docker run -it -p 8080:8080 -v /runpod-volume:/opt/data my_image:latest
Also: serverless templates don't offer the Volume Mount Path option that is present for Pod templates, so that's a no-go as well. Has anyone any idea what I am doing wrong?
4 Replies
Encyrption
Encyrption3mo ago
I have found that the best way to pass media files to a serverless worker is by providing URLs to them. I put them in S3 buckets and provide that to the worker. You can send as many as you need. The worker can be coded to download the URL beofore processing them. I use Digital Ocean Spaces and the url looks like this: https://staticdrop.nyc3.cdn.digitaloceanspaces.com/livep/TestDrivingVideo.mp4
ohno
ohnoOP3mo ago
That was my original thought, but turns out I need about 200 GO of data at a minimum, so downloading it everytime the worker boots really isn't ideal
Encyrption
Encyrption3mo ago
Yikes, that's a load data! @ohno You have your volume backwards. When your network volume is mounted, on RunPod, inside your container it will show up at /runpod-volume if you want to run you container locally and simulate that you should run a command like this:
docker run -it -p 8080:8080 -v /my/local/host/directory:/runpod-volume my_image:latest
docker run -it -p 8080:8080 -v /my/local/host/directory:/runpod-volume my_image:latest
Where /my/local/host/directory is path on your host system (outside the container) If you want your network volume mapped to /opt/data (inside your container) you will need to make symbolic links to somewhere user /runpod-volume
ohno
ohnoOP3mo ago
Symlink worked - thanks for your help!
Want results from more Discord servers?
Add your server