Docker Images

What are Docker Images

  • Docker images are just like OS iso images but are just a scaled-down version of it
  • Docker Image contains
    • Runtime environment
    • Application Code
    • Any dependency
    • Extra Configuration (eg. Environment Variables)
    • Commands
  • Docker Images are made of multiple layers
    • Parent Image : Includes Os and other runtime environment
    • Source Code : (.js or .class files)
    • Dependencies : (Supporting JAR files and initial script to run etc)

Example 1

Running a hello world message on ubuntu

Name of the file : Dockerfile

FROM ubuntu
MAINTAINER suraj kutteri <>
RUN apt-get update
CMD ["echo","Hello world...! from the docker image"]

Building a docker image

docker build -t <name>:<version> <path>

docker build -t tyson332:20240112 .

Running a docker image

docker run <ImageId>

Screenshots of building image

Screenshot of running an image

Parent Image

  • You can get a parent image from docker hub
    • Example : openjdk8
    • To pull the image execute below command
      • docker pull openjdk:8u302-jdk-slim

Leave a Comment