What is Dockerfile, Docker image and Docker container?
When I started reading about Docker, I was confused about the relationship between Docker file vs docker image vs docker container !
Docker file is where I need to script my steps on what actions to be done before I make a docker image. a sample docker file as below: here below in the code,
I am pulling JDK environment in line 1.
Then copying a java class to app directory in line 2,
Then setting app as working directory in line 3 for my docker container after i convert image to container.
Then finally running my app in line 4. FROM java:8-jdk-alpine COPY HelloWorl.class /app/ WORKDIR /app ENTRYPOINT [“java”,”HelloWorld”]
Docker image is created using the above docker file by building it. (command : docker build -t myhelloworldapp . )
Note: dockerfile generates read only layers during the image conversion. These read only layers are created based the dockerfile commandline instructions. Images are considered as executable packages and is predefined. Once it is made, it can not be changed unless new dockerfile is created.
then spin up the container by using command : docker run myhelloworldapp
Web server serves a web content (HTML and static content) over the HTTP protocol.
Application server is a container on which one can build and expose business logic and processes to client applications through various protocols like HTTP. Some cases it will have internal web server. Application server is heavy in terms of resource usage.
Database server refers to the back-end system of a database application using client/server architecture. The database server performs tasks such as data analysis, storage, data manipulation, archiving, and other non-user specific tasks