Day-03 - Docker Multi-Stage Builds:
Gaurav Halnawar
Gaurav HalnawarGaurav Halnawar • FollowingFollowingAWS DevOps Engineer | AWS GCP | Linux | Kubernetes | Terraform | Jenkins CI/CD | Prometheus & Grafana | JIRA | Hybrid Cloud | DevOps EnthusiastAWS DevOps Engineer | AWS GCP | Linux | Kubernetes | Terraform | Jenkins CI/CD | Prometheus & Grafana | JIRA | Hybrid Cloud | DevOps Enthusiast1mo • 1 month ago • Visible to anyone on or off LinkedIn
hashtag#Day-03
Today, I explored Docker Multi-Stage Builds:
Why Multi-Stage Builds:
Reduce image size, improve performance, and keep only what’s needed for production.
Creating the Dockerfile:
1. Two stages:
A). Installer Stage (Node.js) → Install dependencies, build app
B). Deployer Stage (NGINX) → Copy only /build directory
2. Building the Docker Image:
Command: docker build -t multi-stage .
3. Produces a lean, production-ready image without unnecessary files.
Running & Inspecting the Container:
4. Command: docker run -dp 3000:3000 multi-stage
Check logs & explore:
/usr/share/nginx/html → contains only build artifacts
/var/log/nginx → access & error logs
Key Takeaway:
Multi-stage builds make Docker images smaller, faster, and secure, following best DevOps practices.
Read More: https://lnkd.in/d-StMz_G
Today, I explored Docker Multi-Stage Builds:
Why Multi-Stage Builds:
Reduce image size, improve performance, and keep only what’s needed for production.
Creating the Dockerfile:
1. Two stages:
A). Installer Stage (Node.js) → Install dependencies, build app
B). Deployer Stage (NGINX) → Copy only /build directory
2. Building the Docker Image:
Command: docker build -t multi-stage .
3. Produces a lean, production-ready image without unnecessary files.
Running & Inspecting the Container:
4. Command: docker run -dp 3000:3000 multi-stage
Check logs & explore:
/usr/share/nginx/html → contains only build artifacts
/var/log/nginx → access & error logs
Key Takeaway:
Multi-stage builds make Docker images smaller, faster, and secure, following best DevOps practices.
Read More: https://lnkd.in/d-StMz_G
- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Comments
Post a Comment