Docker find all layers in an image - docker

Docker has changed it's backend and now the "docker history" command no longer shows layer IDs of all layers in an image. More details here: https://github.com/docker/docker/issues/20131
Although I understand why it's showing "missing", I still havent found a new way to extract the information I'm looking for. Does anyone know how I can find all the layers in an image? I'd like to be able to cross-reference layers over different images so that I know when a certain layer is used by more than once service, which is why I used the ID shown in the history command up until recentely.
Any help is appreciated, thank you.

Related

Create a docker image so it can be used as base image

This question is a little vague. Sorry I do not have more details. I did an exam a few days ago that involved containers. One question was about optimizing an existing docker file, creating the image and pushing it to docker hub. The docker file included EXPOSE, CMD, LABEL, FROM RUN, ADD instructions.
One of the characteristics of the image was that one should be able to use it as base/parent image for creating other images.
I can't believe this mention was added for no reason. Yet I am not able to understand why this characteristic had to be listed. Is there something specific that one needs to add in docker files for base images? Or are base images stored differently in the registry?
What makes a base docker image different than a normal runnable image?
There is nothing special that you need to do for an image to be reusable. All images can be used in the FROM clause and thus used as base images. The OS needs to match the commands in the file, of course. Also images are made of layers and layers are usually reused between images.
If I would have to look hard for a reason why that was specified as a requirement, I would say that they wanted you to pay attention to:
the size of the final image (make it as small as possible)
documentation (make it easy for others to understand what your image already does)

Datamechanics - spark docker image - example of how to use the connector that comes inbuilt with the image

I came across the below docker image for spark. The image also comes with some of the connectors to some of the popular cloud services. An example of how to use the inbuilt connectors(say Azure storage gen2) in pyspark application will be of great help.
link to dockerhub image
: https://hub.docker.com/r/datamechanics/spark
I looked into the below example that was provided but it didn't help much in understanding how to use the connector that comes with the default image
https://github.com/datamechanics/examples/blob/main/pyspark-example/main.py
There is some more documentation at https://docs.datamechanics.co/docs/docker-images but it is not very helpful to understand how to use the images indeed..
The point that there is no Dockerfile and also no response to reported issues makes it very difficult.
It looks like https://g1thubhub.github.io/docker.html is helpful, although the versions of the images that are used are older.

What is imageMogr2 and what is it used for?

I see that ImageMogr2 is some kind of tool used by qiniu.com (a chinese hosting provider), If some one could help me understand what it is and what similar tech e have with any other hosting provider available.
Yes.
You may see a very similar service provided by tencent cloud has exactly the same name.
its an image processing utility that can scale, crop, rotate images on-the-fly using URI-programming, which means, defining the image processing command and parameters in the request URIs and you'll get the cropped images based on the original image you uploaded before.
You can easily get their documentations and some simple examples on their website.
e.g. https://developer.qiniu.com/dora/api/1270/the-advanced-treatment-of-images-imagemogr2
but not sure if you can read Chinese.
there are similar solutions provided by a us company. e.g.
https://cloudinary.com/

Finding what takes space in a docker image

I'm looking for a visual tool that would take a Docker image and be able to show (in some kind of a chart) what makes the image e.g. 1,2GB large.
In addition to what disk tools would do, it would also tell me which Docker overlay brought that file in.
Is there such a tool or shall I dream on?
Dive does it.
Mentioned here.

Docker terminology confusion

When we do,
docker images
I see a list of images with their repository, tag, image id, created and virtual size.
I understand what image id and created are.
But what is the relationship between repository and tag?
And is the virtual size?
I went through the glossary on their website. But I couldn't find any information about this. The reason I ask is because when I do docker images I sometimes see the same image being listed more than once with the same image id but different tag.
Indeed, I found it confusing as well.
In a nutshell:
an image is uniquely defined by its id (a docker image is analogous to a git commit)
a given image may be tagged one or multiple times (just like git tags)
a repository is a set of images, to quote the documentation: "a repository is a hosted collection of tagged images that together create the file system for a container."
The git analogy might be useful to grasp this.
About the size: "size" is the size of the commit (eg: of the image), while virtual size is the cumulative size of all "previous" images this image is based upon (eg: "all previous commits"). Some info here: https://github.com/dotcloud/docker/pull/594 and https://github.com/dotcloud/docker/issues/22
Does it help?

Resources