Table of contents
Dockerfile
Dockerfile is basically a text file. It contains some set of instructions. Automation of docker image creation.
Dockerfile components
FROM: for base image, this command must be on the top of the dockerfile.
RUN: to execute commands, it will create a layer in image
MAINTAINER: author/ owner/ description
COPY: copy files from the local system (docker vm) we need to provide source, and destination (we can’t download file from the internet and any remote repo.)
ADD: similar to copy but it provides a feature to download files from the internet, also extract file at docker image side.
EXPOSE: to expose ports such as port 8080 for tomcat , port 80 for nginx etc.
CMD: execute commands but during container creation.
ENTRYPOINT: similar to CMD but has higher priority over CMD, first commands will be executed by ENTRYPOINT only.
ENV: environment variables
Create a Dockerfile for a simple web application (e.g. a Node.js or Python app)
Build the image using the Dockerfile and run the container
Verify that the application is working as expected by accessing it in a web browser
Push the image to a public or private repository (e.g. Docker Hub)
Thank you for reading!!
~Shreya Gupta
Great initiative by the #trainwithshubham community. Thank you Shubham Londhe
#devops #90daysofdevops #linux #docker #dockerproject