DevOps Classroomnotes 02/Feb/2022

Docker Images

  • Docker images are required to create containers.
  • From one Docker image, we can create multiple containers
  • Images are build-time constructs and containers are run-time constructs.
  • Let pull some images and observe the stuff as shown below
    Preview
    Preview
  • Docker image is collection of Image Layers
    Preview
  • When we build the image we use some base image and on top of this we do add some stuff related to our applications. Let me write a simple Dockerfile and create a image from this
FROM debian
RUN apt update

Preview
* Now lets inspect the debian image docker image inspect debian and test image docker image inspect test:1.0
Preview
* The test:1.0 uses the layer from debian and adds a new layer this new layer is created as the result of the RUN statement (RUN apt update).
* Now lets build a new docker image test:2.0 with the following Dockerfile and inspect the image

FROM debian
RUN apt update
CMD ["echo", "helloworld"]

Preview
* Lets inspect test:2.0
Preview
* Lets update the Docker file and build the docker image test:3.0

FROM debian
RUN apt update
ADD test.txt /
CMD ["echo", "helloworld"]

Preview
* As we have observed so far, whenever we make changes that leads to some changes in the file system (RUN, ADD) a new layer is getting created
Preview
* Creating too many layers is not considered as good practice so you would often see Docker files with long RUN statements RUN statement1 && statement2
Preview
* The Layers get shared across images
Preview
* We would write Dockerfiles for our applications and create the docker images.

Docker image Registry

  • We can store Docker images centrally in image Registries
    Preview
  • The Default Registries is DockerHub.
  • There are many other Registries to Store docker images
  • Cloud Registries:
    • Azure Container Registry
    • AWS ECR
    • Docker Hub (Public and Private)
    • And many other
  • Hosted Registries
    • Artifactory/Jfrog
    • We can also use Docker Registry Image to store our images

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Wordpress Development Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube