0
0
Spring Bootframework~5 mins

docker-compose for services in Spring Boot - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is docker-compose used for in a Spring Boot project?
Docker-compose helps you run multiple containers together easily. For example, you can start your Spring Boot app and a database with one command.
Click to reveal answer
beginner
In a docker-compose.yml file, what does the services section define?
The services section lists all the containers you want to run. Each service is like a mini-app or tool, such as your Spring Boot app or a database.
Click to reveal answer
intermediate
How do you link a Spring Boot service to a database service in docker-compose?
You define both services under services. Then, in the Spring Boot service, you set environment variables or network settings to connect to the database service by its name.
Click to reveal answer
intermediate
What is the purpose of the depends_on key in docker-compose?
It tells Docker to start one service only after another service is started. For example, start the database before the Spring Boot app so it can connect properly.
Click to reveal answer
beginner
How can you expose your Spring Boot app's port to your local machine using docker-compose?
Use the ports key in the Spring Boot service to map container ports to your computer's ports, like 8080:8080. This lets you access the app in a browser.
Click to reveal answer
What does the services section in docker-compose.yml do?
ASpecifies network rules only
BLists files to copy into containers
CDefines containers to run together
DSets environment variables globally
Which key ensures one service starts after another in docker-compose?
Adepends_on
Blinks
Cvolumes
Dnetworks
How do you make your Spring Boot app accessible on your local machine using docker-compose?
AMap ports with <code>ports</code> key
BSet <code>environment</code> variables
CUse <code>volumes</code> to share code
DAdd <code>depends_on</code> for the app
In docker-compose, how do you connect your Spring Boot app to a database service?
ABy sharing volumes
BBy exposing ports only
CBy using <code>depends_on</code> only
DBy setting the database service name as host
What file do you write to define multiple services for Docker Compose?
ADockerfile
Bdocker-compose.yml
Capplication.properties
Dpom.xml
Explain how you would set up a Spring Boot app and a database using docker-compose.
Think about service definitions, start order, ports, and connection settings.
You got /4 concepts.
    Describe the role of the ports and depends_on keys in a docker-compose.yml file.
    One is about access, the other about timing.
    You got /2 concepts.