How You Know You're Doing Dockerfile The Right Way





What is Dockerfile?

Text file with clear instructions to build an image/we can say Automation of Docker image creation

Summary:
1. This Article will help you how to create Dockerfile 
2. Add commands/or instructions in Dockerfile
3. Build Dockerfile to create image 
4 .Run image to create a Container

Note:
Dockerfile starts - FROM -this is the first instruction in dockerfille 

Also Read 
Example:   
FROM ubuntu - get the base image from Ubuntu 
  
FROM scratch - build an image from scratch 

what content we are going to write in Dockerfile?

Dockerfile
 
#getting the base image from Ubuntu 
  FROM ubuntu
  MAINTAINER chandra <csrcg19@gmail.com>
  RUN apt-get update 
  CMD ["echo"," Hello World...! from my first docker image"] 

Explanation:
FROM?
Where you want to start and what is it.

MAINTAINER ?
Whos is maintaining the this image and author name and mail id.

RUN?
We are giving instructions to update the Ubuntu OS.

Finally CMD?
While creating image it will not run and only while creating a container or running the Docker image then only it will execute 


Now we are ready to build image 
docker build -t firstimage:1.0 .

If you like this article subscribe and share 
Follow Our Channel 



Chandra Sekhar

A Blogger and Author! This post was written and edited by me, a technologist. I started this site to share my inspirations, work, and free materials, which I hope others may find useful as well. Man with a creative streak who enjoys experimenting with various web design strategies.

Previous Post Next Post

Microservice Communication in a Distributed System