Determining size of layers in Docker image

Maybe this has been solved already but i’m looking to figure out what is making the Docker image i’m building so incredibly enormous (19Gb starting from a 100mb image)…

In order to do this seeing the size of each of the layers that is added would be INCREDIBLY useful, but i’m not quite sure how to go about doing that. I can do it with regular docker by using docker history.


Hey @dborgesr,
Wow, 19GB is massive. You could share your Dockerfile here and some of the forum might be able to eyeball which part is making it bloat. You also might be able to find interesting info using the docker inspect and/or docker history command on that built image.

By all means, here is the dockerfile i use:


I think a lot of the bloat might be coming from CUDA? also i’m not sure how to run docker history on an image that was built by resin?


From a quick look, you have your install and cleanup steps separated.

Each RUN line generates a new layer in a Docker image. The overall size of an image is a combination of all the layer sizes, so if you can clean up in the same step as you build or install, it will minimize the size of the layer.

You can run resin build to build your image locally.

Then once it’s built, you can figure out what docker named it by looking at the top result of docker images, then docker history <image-name>.

Thanks for the reply, already being useful. I got resin build working (after setting the right docker daemon port etc) but I seem to be unable to curl download things from inside the container, specifically this line:

RUN curl -o /tmp/Tegra186_Linux_R28.1.0_aarch64.tbz2 -sL && tar xvfj /tmp/Tegra186_Linux_R28.1.0_aarch64.tbz2 && chown root /etc/passwd /etc/sudoers /usr/lib/sudo/ /etc/sudoers.d/README && /tmp/Linux_for_Tegra/ -r / && rm -fr /tmp/*

is giving this error:

returned a non-zero code: 6

Which from what i read has to do with network permissions while running docker, and I honestly have absolutely 0 idea on how to fix this, i’m not a network guy.

Any suggestions? i’m sure i can figure out what’s bloating the image once i get it building using resin build. Its interesting that the build works if i just do git push as well.

–Thank you very much