Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

Chapter 54: Dockerfile Examples for Node.js, Python Flask and Django, Spring Boot, .NET, Go, PHP, nginx, MySQL, Postgres and Redis: Cards

मराठी cards · Open the chapter

Revision cards

Dockerize a Node.js app. Each stack has its own best Dockerfile pattern.
Revision card 1 of 9: Dockerize a Node.js app · Download PNG · Open card page

Lesson: 54.1 Node.js Dockerfile (Express) for production

Dockerize Flask and Django. Each stack has its own best Dockerfile pattern.
Revision card 2 of 9: Dockerize Flask and Django · Download PNG · Open card page

Lesson: 54.2 Python Flask and Django Dockerfiles

Dockerize Spring Boot. Each stack has its own best Dockerfile pattern.
Revision card 3 of 9: Dockerize Spring Boot · Download PNG · Open card page

Lesson: 54.3 Java Spring Boot Dockerfile with layered jars

Dockerize .NET. Each stack has its own best Dockerfile pattern.
Revision card 4 of 9: Dockerize .NET · Download PNG · Open card page

Lesson: 54.4 .NET 8 ASP.NET Core Dockerfile

Dockerize a Go app. Each stack has its own best Dockerfile pattern.
Revision card 5 of 9: Dockerize a Go app · Download PNG · Open card page

Lesson: 54.5 Go Dockerfile with scratch or distroless

PHP-FPM with nginx. Each stack has its own best Dockerfile pattern.
Revision card 6 of 9: PHP-FPM with nginx · Download PNG · Open card page

Lesson: 54.6 PHP-FPM with nginx Dockerfile (Laravel style)

nginx as a container. Each stack has its own best Dockerfile pattern.
Revision card 7 of 9: nginx as a container · Download PNG · Open card page

Lesson: 54.7 nginx as a static site and reverse proxy

MySQL and Postgres in containers. Each stack has its own best Dockerfile pattern.
Revision card 8 of 9: MySQL and Postgres in containers · Download PNG · Open card page

Lesson: 54.8 MySQL and Postgres containers done right

Redis in a container. Each stack has its own best Dockerfile pattern.
Revision card 9 of 9: Redis in a container · Download PNG · Open card page

Lesson: 54.9 Redis container with persistence and a password

Interview cards

Why npm ci and not npm install in Docker? npm ci installs exactly from package-lock, is faster, and fails on mismatch: repeatable builds.
Interview card 1 of 9: Why npm ci and not npm install in Docker? · Download PNG · Open card page

Lesson: 54.1 Node.js Dockerfile (Express) for production

Why gunicorn and not flask run in the container? The dev server is single-threaded and unsafe for production; gunicorn runs worker processes and handles signals.
Interview card 2 of 9: Why gunicorn and not flask run in the container? · Download PNG · Open card page

Lesson: 54.2 Python Flask and Django Dockerfiles

How do you size Java memory in a container? Modern JVMs read the cgroup limit; set -XX:MaxRAMPercentage=75 so heap plus overhead stays under --memory.
Interview card 3 of 9: How do you size Java memory in a container? · Download PNG · Open card page

Lesson: 54.3 Java Spring Boot Dockerfile with layered jars

Why two images for .NET? The SDK (compilers) is large; the aspnet runtime is much smaller and safer. .NET 8 images listen on 8080 and can run as non-root.
Interview card 4 of 9: Why two images for .NET? · Download PNG · Open card page

Lesson: 54.4 .NET 8 ASP.NET Core Dockerfile

Why can a Go image use scratch? With CGO_ENABLED=0 the binary needs no libc. Add CA certificates (or use distroless) for HTTPS calls.
Interview card 5 of 9: Why can a Go image use scratch? · Download PNG · Open card page

Lesson: 54.5 Go Dockerfile with scratch or distroless

Why are nginx and PHP-FPM separate containers? One process per container: scale and update each alone. nginx talks to php:9000 using fastcgi_pass.
Interview card 6 of 9: Why are nginx and PHP-FPM separate containers? · Download PNG · Open card page

Lesson: 54.6 PHP-FPM with nginx Dockerfile (Laravel style)

How do you reload nginx config in a container? Test then reload: docker exec web nginx -t and docker exec web nginx -s reload.
Interview card 7 of 9: How do you reload nginx config in a container? · Download PNG · Open card page

Lesson: 54.7 nginx as a static site and reverse proxy

When do init scripts in docker-entrypoint-initdb.d run? Only when the data directory is empty (first start). With existing volume data they are skipped.
Interview card 8 of 9: When do init scripts in docker-entrypoint-initdb.d run? · Download PNG · Open card page

Lesson: 54.8 MySQL and Postgres containers done right

How do you persist Redis data in Docker? Enable AOF (--appendonly yes) or RDB snapshots and mount a volume on /data.
Interview card 9 of 9: How do you persist Redis data in Docker? · Download PNG · Open card page

Lesson: 54.9 Redis container with persistence and a password

Comparison cards

Build image vs Runtime image. Build: SDK, compilers, tests.Runtime: just what runs the app.
Comparison card 1 of 3: Build image vs Runtime image · Download PNG · Open card page

Lesson: 54.3 Java Spring Boot Dockerfile with layered jars

scratch vs distroless. scratch: totally empty.distroless: minimal files, CA certs, users.
Comparison card 2 of 3: scratch vs distroless · Download PNG · Open card page

Lesson: 54.5 Go Dockerfile with scratch or distroless

MySQL vs Postgres containers. MySQL: mysql:8.4, data /var/lib/mysql.Postgres: postgres:16, data /var/lib/postgresql/data.
Comparison card 3 of 3: MySQL vs Postgres containers · Download PNG · Open card page

Lesson: 54.8 MySQL and Postgres containers done right