Create a Docker Image for a VisualSLAM project present on GItHub

Hello everyone, I recently started my journey with Docker and I’m still a beginner. I would like to create a Docker image for a Visual SLAM project that is available on GitHub (here’s the link: GitHub - HengyiWang/Co-SLAM: [CVPR'23] Co-SLAM: Joint Coordinate and Sparse Parametric Encodings for Neural Real-Time SLAM). Although I have a basic understanding of Docker and its main commands, I’m not sure where to begin in creating a Dockerfile that can run the entire project.
I’m stuck also to the fact that the project require CUDA, so I guess that my base image from which I could start, it could be nvidia/cuda, but I don’t knwo how to use it.

I would greatly appreciate any suggestions, tutorials, or resources that could help me in creating the Docker image. Thank you in advance for your assistance!

I don’t know that project, but it is not always possible to create a Docker image for a project without modifications. And if it is possible, it could require multiple images or one image that runs a process manager which runs everything else. If the project just a collection of scripts based on python, conda and GPU, you could install everything in one image and use docker run -it --rm imagename script.sh (or most likely a more complicated command).

Are you sure you need a container and not a vitual machine for example?

What do you mean by using it? As a base image to build a new image or run a container from the cuda image and it’s features inside?

Thanks a lot for the answer.
Do you have some suggestion about some book or documents for understanding how to do that?
What I’ve read and studied until now it is just theory, but now that I have to implement it for my specific case, I feel a little bit scattered. I saw online others Docker image regarding Visual SLAM, but everything was hidden, so there is no Dockerfile from which to take inspiration. The only one is ORB-SLAM3 link: GitHub - jahaniam/orbslam3_docker: ORBSLAM 3 docker with GUI, so I thought to follow it as reference, but my project is a little bit different.

I could try. Yes I have all python scripts with some dataset to be implemented.

I don’t know if a virtual machine is better, but everyone spoke about a parrelism between docker and a virtual machine, so I don’t know how to understand what is better, based on my purpose.

I mean to use it in the command FROM inside the docker file. So to use it as the base image for my docker image. It could be right? I saw another docker image that required CUDA and it did in this way.

Building a Docker image? Please, when you refer to something specific I wrote with “that”, quote that part so I can quickly answer.

If that image is from Docker Hub, you can check the image history online. Go to the “Tags” tab, choose a tag and unless the the actual commands were hidden in a shell script, you cans ee the commands that created the image. Example:

https://hub.docker.com/layers/nginxproxy/docker-gen/latest/images/sha256-b49c701060ef09deb03991dbe0d21170cfc2a9cec529e1fd57b3bcfedeefb4eb?context=explore

You can also see that list locally. Example for php:8-fpm

docker image history php:8-fpm --no-trunc --format '{{ .CreatedBy }}'

Just replace php:8-fpm with the actual full image name you want to check.
The last line in the list oif commands will be the first that ran during the build. If you want to list in reverse in a bash shell, you can run this:

docker image history php:8-fpm --no-trunc --format '{{ .CreatedBy }}' | tail -r

A container is usually better, unless you need too many tools in one container which requires a huge container image. Even then containers could be better if only one script has to run at a time, unless that script wants to do something that requires too many configurations and special permissions for the container. You also need a virtual machine when you want a lot of services running at the same time. Two or three could be oka,y but as I mentioned before that requires a process manager like supervisord.

Yes, FROM means you want to base your new image on the image that follows the FROM instrution. If you need an idea for better Google keywords, I would try “docker cuda tutorial”.

Just the first result I found: