ARG:
if you want to pass or change something in that can set during image build you can use this instruction
This will be available till image build.
It has life time of till building an image
ENV:
this will be environment variable available in RUN container.
It has life time of building an image and running container.
This value can be set or changed while container is created.
For ex: if you want to select database when app is running , you can choose that DB by using ENV variable.
ADD:
if you want to download file from URL(from internet) , you can use this instruction
COPY:
If you want to copy your local file to image to build image you can use this instruction.
FROM:
its a base and primary command to build docker image at the starting of Dockerfile.
CMD:
to run any scripts or any commands while building image or in container , you can use this instruction.
RUN:
Expose:
to expose your container to specific port , you can use this instruction.
Healthcheck:
you can use this instruction to check health of image or container for timeout, interval and stop states.
ONBUILD:
you can use this instruction while building an image .
.dockerignore:
If you want to ignore any files or sensitive information , you can use this file to ignore while building an image.
Sample webapp to push docker image to Docker hub
No comments:
Post a Comment