Hi Guys Today is a very Special tutorial of how to create a docker image from scratch.
A Simple way to create docker image.
The workflow of Dockerfile and building is very simple. It goes like this….
- Docker first run’s the container that you mentioned us FROM (in our case its Java 8). So docker first pulls down that image ,and run’s it.
- It then looks for the first instruction after that, and after executing that, it does something similar to #docker commit, so that it saves a layer with what is done till that instruction.
- Docker run’s a new container with the last committed image (ie. The image created from the previous instruction step in the Dockerfile. The Running in type of messages during the build command showed in the above example indicates this.)
- It then executes the next instruction in the Dockerfile, and again does a commit and creates another image. So that the very next instruction is executed inside this new image committed. And this process continues till the very last instruction in the Dockerfile.
Feel free to comment for any doubts.
If you like please share and subscribe 🙂