How would I download built application images for introspection?

I want to use dive to optimize my layer sizes. How would I pull released images targeted for a Raspberry Pi 3 from Balena’s registry? (Not sure if I could even run dive on those images, but I’d like to try!)

You would need a devices key and to use these as a docker login. The details are in config.json for this.

From my understanding this should work although I’ve never tried.

Alternatively have you thought about balena save on the HostOS?

Hi

you can pull balenalib images as any other docker image. For example docker pull balenalib/raspberrypi3-debian-node:8-run. Then you can analyse it using dive with dive balenalib/raspberrypi3-debian-node:8-run

federico

Hmm, looks like balena save gives me all the image layers as multiple directories – can I load that into my local docker images?

I guess a better question to ask is: how would I docker pull a released image I’ve created using balena push? Similar to this question.

Hi Nick,
the solution suggested in the post you linked is still my best guess. Does that wor for you ?
Pulling the image from the registry will require permissions / credentials you do not have so I doubt that will work for you.
Regards Thomas

In regards to your first question, I think you can simply use docker load to load the docker image produced by balena save to inspect with dive on your local machine. There is some more here with the syntax to use https://pspdfkit.com/blog/2019/docker-import-export-vs-load-save/

1 Like

Worked like a charm!

For anyone else looking on how to do this, here’s the steps I took:

# In Host OS container
balena ps  # copy IMAGE ID

balena save -o <IMAGE_ID>.tar <IMAGE_ID>
scp <IMAGE_ID>.tar <USER>@<HOST>:<PATH>

# On user machine
docker load -i <IMAGE_ID>.tar
dive <IMAGE_ID>