Spring Boot

Spring Boot & Docker

Containerization with Docker: Dockerfile, multi-stage builds, optimized images, docker-compose, Spring profiles

19 pytań z rozmów·
Senior
1

What is a layered JAR in Spring Boot?

Odpowiedź

A layered JAR organizes JAR content into distinct layers (dependencies, spring-boot-loader, snapshot-dependencies, application) to optimize Docker builds. Each layer can be cached separately, which significantly speeds up rebuilds since only modified layers are rebuilt. This approach reduces production deployment times by 80%.

2

What is the role of Spring Boot Buildpacks?

Odpowiedź

Buildpacks automatically create optimized Docker images without requiring a Dockerfile. They detect the application type, install the appropriate runtime, configure JVM optimizations, and apply security best practices. This approach eliminates manual Dockerfile maintenance and ensures industry-standard compliant images.

3

Which Dockerfile instruction to copy the JAR into the image?

Odpowiedź

The COPY instruction transfers files from the host system to the Docker image. For Spring Boot, we typically use COPY target/*.jar app.jar to copy the built JAR. This instruction creates a new layer in the image and supports wildcards for filename flexibility.

4

How to expose a port in a Dockerfile?

5

Which base image should be prioritized for a Spring Boot container in production?

+16 pytań z rozmów

Opanuj Spring Boot na następną rozmowę

Uzyskaj dostęp do wszystkich pytań, flashcards, testów technicznych, ćwiczeń code review i symulatorów rozmów.

Zacznij za darmo