How to create custom container

Hello,
I’m new to docker containers, so apologies if this is too obvious.
I’ve gone through the various Isaac ROS tutorials. Now I would like to have a clean image with the packages I need pre-installed.
Is there a recommended way to do this while keeping the same benefits as the base image, such as using Isaac-ros activate, which creates the container and mounts the workspace folder?

Any assistance is appreciated.

Hello @ar.gounot,

What you need to do is create a Dockerfile, so you can easily build, replicate and maintain your custom image along your project.

And, if you want to maintain the base image you used for testing, you can make sure to include it as part of your Dockerfile.

So for example. Let’s say that you want to build a Docker image on top of GoldenROSImage. And, you want to add packages Package1, Package 2 and Package 3 on top. Then, your Dockerfile, would look something like:

FROM GoldenROSImage #Base image for the build

RUN apt install Package1 #Install your debian based Package1

RUN pip3 install Package2 #Install your Package2 via pip

#Install your Package3 from source
RUN git clone Package3.git && \
         cd Packge3 && \
         make && \
         make install

Apologies for the rough representation of a sample Dockerfile. But I hope that gives you an idea of how it works.

Then you can build your image with:

docker build -t your-image-name:tag .

And then you can run your container using that image.

If you want, you can give me the name of the base image you want to use, and some of the packages you want to install and I can give you a sample Dockerfile you can use to build on top of.

best regards,
Andrew
Embedded Software Engineer at ProventusNova

1 Like

Hello, Thank you for your help.

Here is my dockerfile :

FROM nvcr.io/nvidia/isaac/ros:noble-ros2_jazzy_d3e84470d576702a380478a513fb3fc6-amd64

RUN apt-get update && apt-get install -y \
    ros-jazzy-isaac-ros-yolov8 \
    ros-jazzy-isaac-ros-dnn-image-encoder \
    ros-jazzy-isaac-ros-tensor-rt \
    && rm -rf /var/lib/apt/lists/*

What I’d like is to maintain the ease of use of the tutorials with isaac-ros activate, which launches a well-configured container.

Is it possible to achieve a similar launch using this new image?

Alternatively, I saw that it’s possible to add images to the launch process, such as RealSense. Would it be possible to add the packages using a simple Dockerfile?
When I try, I get the following error:

~$ isaac-ros activate --build-local /home/arthur/workspaces/isaac_ros-dev Logged in to nvcr.io/nvidia/isaac/ros. Using this for cache. ['noble', 'ros2_jazzy', 'object_detection'] Dockerfile created: image_key = noble Dockerfile created: image_key = object_detection Dockerfile created: image_key = ros2_jazzy Error response from daemon: failed to resolve reference "nvcr.io/nvidia/isaac/ros:noble-ros2_jazzy-object_detection_92f981d04a82ab1c626475e80f69d22c-amd64": nvcr.io/nvidia/isaac/ros:noble-ros2_jazzy-object_detection_92f981d04a82ab1c626475e80f69d22c-amd64: not found

Hello @ar.gounot,

If you still want to use isaacpros activate and add your own packages with a simple Dockerfile, you will need to follow the instructions provided by NVIDIA Official Documentation here.

This is the sample Dockerfile structure they provide:

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

... steps ...

COPY myfile.txt /myfile.txt

... more steps ...

Since the final image will be built by isaac-ros cli, the BASE_IMAGE environment variable will be provided during build.

Please let me know if you need further help with this.

best regards,
Andrew
Embedded Software Engineer at ProventusNova