When I started reading about Docker, I was confused about the relationship between Docker file vs docker image vs docker container !
Short answer to my question is:
1. 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. copying a java class to app directory in line 2, 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”]
2. Docker image is created using the above docker file by building it. (command : docker build -t myhelloworldapp . )
3. then spin up the container by using command : docker run myhelloworldapp
Knowledge courtesy : Taji Philip.