ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

docker minimal image

asked 2023-01-16 02:46:54 -0500

luchko gravatar image

Hello,

TL;DR : Does anyone manage to make a "slim" version of ros:noetic-ros-core-XXX image?

I am currently trying to use ROS Noetic in a "multi container with docker compose app". To begin, I wanted to separate ros core component to another container. I was happy to find official OSRF image.

But ... final size on my device is more than 730 MB ! That would make me think twice about separating my ros nodes along multiple containers...

I read this topic : Reduce only build-related ROS packages - reduce docker image size but I can't understand what makes ros-core images such weighty.

Question : Does anyone have experience with "minimal required stuff to make a docker image that will only consist of a roscore" ?

Thanks

edit retag flag offensive close merge delete

Comments

Thank you for these readings, I have to admit that I did not understood 100% but that was very interresting.
My understanding is that OSRF official images weight is mainly due to ros "runtime" deps that are allready optimized.
That will make me think twice about multicontainer docker-composed app :(

luchko gravatar image luchko  ( 2023-01-16 04:10:55 -0500 )edit
1

My understanding is that OSRF official images weight is mainly due to ros "runtime" deps that are allready optimized.

I'm not sure what you are writing here.

My understanding is that it's mostly due to how Debian packages work: even if you need only a tiny part of a dependency, you'll still have to install the complete Debian package. That's normal and accepted: packages cannot consist of only single files, so they (logically) group things together, leading to larger sizes (but less packages).

Follow this reasoning over a couple 'layers' of dependencies, and it quickly leads to MBs of 'wasted' space, because transitively, many dependencies will depend on only small parts of their dependencies, and so on.

gvdhoorn gravatar image gvdhoorn  ( 2023-01-16 04:37:07 -0500 )edit

That will make me think twice about multicontainer docker-composed app

why exactly? AFAIK and IIRC, Docker is capable of caching and deduplication per layer, so if you have multiple images starting FROM the same image, there should be no duplication. Or at least not up to the point where your changes start.

gvdhoorn gravatar image gvdhoorn  ( 2023-01-16 04:40:31 -0500 )edit

That will make me think twice about multicontainer docker-composed app because I am using balena fleet management system which, if I rellay want to eg. split my ROS app into multiple containers, lead to N services in docker-compose, which leads to N * 730MB services running on my final device.

EDIT: regarding you first comment about "my understanding", that is what I thought, explaining it too simply, thank you again for your clarifications.

In conclusion, I can split my ROS app into multiple docker services on a balena device only if I am okay with that 730MB duplication, so I will have to analyse pros and cons !

thank you again

luchko gravatar image luchko  ( 2023-01-16 09:07:55 -0500 )edit

In conclusion, I can split my ROS app into multiple docker services on a balena device only if I am okay with that 730MB duplication

I'm repeating myself, but: IIUC, that wouldn't necessarily be the case.

See my earlier comment about layer caching and deduplication in Docker. I'd suggest to try it with a small experiment and verify.

gvdhoorn gravatar image gvdhoorn  ( 2023-01-16 09:38:05 -0500 )edit

That what I did earlier this morning. I can confirm that each of my service weight 730MB. that's probably due to how balena "modified" docker engin works... I will investigate that later if times allow it.

luchko gravatar image luchko  ( 2023-01-16 09:39:56 -0500 )edit

On a regular Docker system/install you could run docker system df -v to see how big each Docker image "really" is. Especially with only a couple of images, the relationship between what they share and their size should be relatively easy to figure out.

I don't know what Balena did, so I can't comment there. If they're using/providing a stand-alone/isolated environment per image, then it's possible they can't share with other images.

gvdhoorn gravatar image gvdhoorn  ( 2023-01-16 09:48:01 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2023-01-16 13:55:01 -0500

luchko gravatar image

See @gvdhoorn comments on my question for answer about ROS related projects "weight".
Note : My source issue, diskspace, is not anymore if you are using docker-compose, layer deduplication will allow tour application to use "just the space needed for 1 service", as soon as your images are equals. I am looking for more details right now.

NB: Sorry @gvdhoorn, logs of balena deploy where erroneously displaying diskspace usage.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-01-16 02:46:54 -0500

Seen: 354 times

Last updated: Jan 16 '23