I created a Docker image locally using following sample Docker file
FROM ubuntu
ADD myfile.zip /opt/myfile.zip
If I push the built image to DockerHub as a public image, does that image
contain both files from ubuntu image and myfile.zip or does it only contain myfile.zip? If it contains only myfile.zip, when someone pull the image from DockerHub does he have to manually / automatically pull ubuntu image first?
The image will contain the Ubuntu docker image, and your mufile.zip.
You can check the size shown by
docker images ubuntu
and
docker images yourimage
Things may have changed since this article
https://www.brianchristner.io/docker-image-base-os-size-comparison/
but Ubuntu was 188 MB at that time, your image should be bigger by the size of your zip
This docker documentation explains it
https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/
Related
I create docker image of my application (songkong/songkong) but I notice it doesnt have an icon whereas many other docker images do, how do I add an icon to the docker image ?
(my docker image is available on docker hub)
Not all official images have an associated icon. For instance, adoptopenjdk.
An image like logstash would use a logo.png in the docker-library/docs repository.
docker-library/docs issue 1060 asked: How do you add the icon for an image on Docker Hub?
But... there does not seem to be any formal process associated to that.
Only to become an official image.
We have a private harbor registry that's insecure. We use docker client on a centos7 VM to push /pull images. We lost the docker client centos7 VM so have installed a new one. The issue I see is I log into the registry but when I do "docker image list" or "docker images" it doesn't show the images previously loaded. I'm not sure why?
[udmuser1#vtc-spk-auto10 ~]$ docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
If I do a docker load -i image on the new linux VM then docker push I do see the image when doing "docker image list" on the registry.
[udmuser1#vtc-spk-auto10 ~]$ docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
harbor01.ims.net/library/f5-fluentd v1.4.2 b96d9e18a71c 9 months ago 495 MB
I'm unclear why I don't see the images that were loaded by the previous linux VM.
Thanks for any input on this.
John
Your local Docker client would show you images that are part of its docker daemon in other words the images present on your client. You would need to setup synchronization if you want similar images on both the ends.
The container Registry is a place where you push/pull images to and from.
Your local Docker Client contains only the images that fulfil the criteria:
The image was pulled from a registry
The image was build (on that machine)
The container images you are not synchronized with your registry, you need to explicitly push and pull those images.
Your private repository and local machine are two different things. You can't get to the images in your private repository if you lose access to it.
To list all image repositories that contain at least one tagged image, run this curl command:
curl https://registry.io/v2/_catalog
{"repositories":["alpine","postgres"]}
If there are image repositories in a registry that don't possess a single tag, and instead only possess digests e.g. ubuntu#sha256:ac13c5d2, those will be omitted from the output. If a registry contained ubuntu#sha256:ac13c5d2, alpine:latest, and postgres:15.1, Output from /v2/_catalog would read as {"repositories":["alpine","postgres"]}.
Images can be obtained in a more granular and complete method through use of:
https://registry.io/v2/{image}/manifests/{digest} for images with digests
https://registry.io/v2/{image}/tags/list for images with tags
docker pull localhost:21518/master:latest
Getting following response:
Trying to pull repository localhost:21518/master ...
Pulling repository localhost:21518/master
Error: image master:latest not found
Whereas docker images returns
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost:21518/master latest e9f29fbf9931 6 hours ago 703 MB
Why image is not getting pulled?
docker images shows the list of cached images and not repository images. I got confused that docker images showing images from repository as repository is also running on local machine.
Needed to do docker push to get image in repository.
If I want to build a docker image,
I need to base on a docker base image.
All the example I found are based on top of official images.
Can I base my image on other docker user images ?
The FROM line in your Dockerfile can point to any image. It may be an upstream image from the Docker hub, one on any other registry server including one you self host, or it may be another image you've built locally on your own docker build host. Lastly, it may be FROM scratch which starts without any base image, and is used by other base images at some point in their history.
Is it possible to keep backup of docker images?
Here is my docker image:
my#onl-dev:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centdemo latest e0b0d89f6c45 2 days ago 3.322 GB
I have some data in this docker image which I copy from container to host whenever needed.
root#onl-dev:/distros/centos6.6.x86_64# docker cp 9512b894d107:/distros/centos6.6.x86_64 /data/sept15/mess
So I want to keep backup of this docker image such that I can restore it whenever I want to copy the data from container to host.
You can simply tag the image with different tag
docker tag <image-name>:latest <image-name>:backup
Nonetheless you can always use the image ID: e0b0d89f6c45
Another option is to store it in a tar.
docker save mynewimage > /tmp/mynewimage.tar