Creating Dockerfile with from, run, cmd, entrypoint, copy, add, volume, expose | in Hindi

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
now there are three more instructions which are used for command executions cmd entry point and then mkdir docker files in this directory we are going to place our docker file cd docker files let's create docker file touch docker file let's start editing vim docker file building image as this is commented line so it will not impact on docker layers here we are going to mention our first instruction that is from this instruction tells docker that from which base image you want to build final image i want to take ubuntu as this image now this will be your base image and you can add any layer on this image now let's instruct about maintenance these three instructions one by one if we talk about run it executes at the time of building the image let's write here apt-get update now let's talk about cmd this instruction executes when you are creating container out of the image let me tell you again on diagram run executes when you are building image and cmd executes when you are creating container out of the image there can only be one cmd instruction in a docker file if you list more than one cmd then only the last cmd will be considered echo let's learn let's save and exit let's build this image now docker build hyphen t so that we can tag to image image name rpn image colon now need to mention tag let's mention version 1. now we have to give path of docker file as i am in same directory where docker file is there so going to use dot enter here we can see image is created successfully and we have got image id let's check images docker images grab rpn image here we can see name of image tag but if i give argument while running container what will happen here i am rpn again we can solve this problem with entry point it is almost similar to cmd and executes while creating container out of image docker file let's build image docker build hyphen t rpn image let's give new tag version 2 dot here is the image id let's take this image id up run karthik container without argument docker run id enter now you can see here let's learn hope you have come to know major difference between cmd and entry point now let's understand copy and add instructions let's create a index.html file here touch index.html file or create touch robots.txt vim docker file let me comment these lines to avoid confusion let's mention copy instruction we had created index.html at the same location where docker file is there and this is the source of our host machine slash stamp this will be destination path pointed to docker image so what we want we want that index.html should be copied to stamp at image let's put one more instruction add we had created one more file robots.txt and keep destination same as in copy save and exit image go docker build hyphen t rpm image version 3 is the new tag dot enter here we can see copy and add instructions worked properly and copied file at the [Music] destination like add here you can mention any url and here you can mention destination path here i want to mention one more instruction work dir you can mention any path like slash stamp is instructions say run cmd entry point copy add now is create a mount point for the container if you mention any path like slash app now this will be mount point for container we have already covered volume related things in docker tutorial fifth part you can watch there let's understand another instruction that is exposed the exposed instruction informs docker that the container listen on the specified network port at runtime let's mention port 80 here we can mention protocol like tcp you can also add with udp if the protocol is not specified tcp will be the default protocol you can use hyphen p to publish port while running the container we have already covered this right guys there are some more instructions lets then try in upcoming advanced topics guys i hope you are going to do a lot of practice with this docker file in next part we are again going to create image but this time we will create image from container till then have a nice time
Info
Channel: Learn with RPN
Views: 2,157
Rating: 4.7735848 out of 5
Keywords: dockerfile, Dockerfile, dockerfiles, hot to build image with dockerfile, cmd vs entrypoint, copy vs add, how to use expose in dockerfile, instructions for dockerfile, why dockerfile, dockerfile vs docker compose, dockerfile in hindi, docker tutorial in hindi, commans for dockerfile, dockerfile best practice, best online video for dockerfile, best docker course on youtube, learn dockerfile in easy way, creating docker image with dockerfile, docker complete course in hindi, devops
Id: 9f1y4ZlFaQk
Channel Id: undefined
Length: 11min 43sec (703 seconds)
Published: Sun Nov 01 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.