What are the basic commands to build a Docker image, and where do you store Docker images?

Building a Docker image for a Spring Boot application starts with a Dockerfile describing the base image and build steps, and the resulting image is typically stored in a container registry such as Docker Hub or a private cloud registry.

Key Points

Example

After writing a Dockerfile that copies app.jar and runs java -jar app.jar, the team builds the image with docker build -t myapp:1.0 ., tags it for their registry, and pushes it so it can be pulled during deployment.

FROM eclipse-temurin:17-jre-alpine
COPY target/app.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
docker build -t myapp:1.0 .
docker tag myapp:1.0 myregistry.azurecr.io/myapp:1.0
docker push myregistry.azurecr.io/myapp:1.0

Interview Tip

A concise interview answer is

I write a Dockerfile that defines the base image and startup command, build it with docker build -t, and store the resulting image in a registry, usually a private one like ECR or ACR for internal apps, or Docker Hub for public images. From there the image gets pulled during deployment.

Last updated: 11 November 2026

Previous question: Suppose you need to ensure zero downtime deployments for a Spring Boot e-commerce application. What approach would you take?

Next question: What is Spring Cloud Sleuth used for, and what replaces it in Spring Boot 3?

More Spring Boot - Level V (Expert) interview questions

All Spring Boot - Level V (Expert) questions