🚀Day 17 - Docker for DevOpsEngineers - Dockerfile🐳
📋 Dockerfile is a recipe for building a container. It directs Docker on the base image to use, commands to execute, and files to include. For instance, creating a website container might involve using an official web server image, copying site files, and initiating the web server at container start.
🔧 Common Dockerfile Commands:
🔹 FROM: Specifies the base image to build upon. E.g., using an official Node.js image for a Node.js-based application.
🔹 RUN: Executes commands during the image build. Installing necessary packages or dependencies is a typical use case.
🔹 COPY: Transfers files from the host machine to the image. Handy for adding application files into the container.
🔹 ENV: Sets environment variables within the image. Useful for defining application versions or configurations.
🔹 EXPOSE: Declares exposed ports within the container. For instance, exposing port 8000 for external access.
🔹 CMD: Defines the command to run when creating a container from the image. Setting the startup command for the application is a common practice.