Wednesday, December 11, 2024

Day02 : docker init | dockerfile

 Task today to explore:

  • docker init
  • dockerfile
  • containerizing sample app 

 

  • docker init :
    • docker init is way to create all necessary files automatically. 
    • When we run docker init command it will ask for questions like as platform, version of platform, working dir commend to run to start application.
    • Once this complete it will create few files Dockerfile, .dockerignore, compose.yaml etc
    • In short docker init is way to quickly create Dockerfile with its dependency.   
  •  Dockerfile :
    • Its an file defines how your image to be build. each line in this file forms an layer (some commands are excepted to create separate layer)
    • Few commands can be used in Dockerfile:
      • FROM: Specify base image
      • RUN: execute command in container while building image. this could be needed to install some dependencies. 
      • COPY: copy files from host directory to container directory
      • WORKDIR: specify working directory in container 
      • EXPOSE: used to expose port where service is running.
    • Sample docker file:


No comments:

Post a Comment

Day 07: Pod Creation Declarative way

Two way to create pods in Kubernetes cluster Imperative Way: Run every command manually with kubectl utility. kubectl run ngnx --image=ngin...