0
0
Spring Bootframework~10 mins

docker-compose for services in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the Docker image for the service.

Spring Boot
services:
  app:
    image: [1]
Drag options to blanks, or click blank then click option'
Abuild
Bdockerfile
Cmy-springboot-app:latest
Dcontainer_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'build' or 'dockerfile' instead of 'image' to specify the image name.
Leaving the image name empty or incorrect.
2fill in blank
medium

Complete the code to expose port 8080 from the container to the host.

Spring Boot
services:
  app:
    ports:
      - "[1]:8080"
Drag options to blanks, or click blank then click option'
A80
B443
C3000
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using a port different from 8080 on the container side.
Swapping the ports in the mapping.
3fill in blank
hard

Fix the error in the volume mapping to persist data.

Spring Boot
services:
  db:
    volumes:
      - [1]:/var/lib/postgresql/data
Drag options to blanks, or click blank then click option'
A/var/data
B./data
Cdata
D/data
Attempts:
3 left
💡 Hint
Common Mistakes
Using just 'data' without './' which Docker Compose treats differently.
Using an absolute path that does not exist on the host.
4fill in blank
hard

Fill both blanks to define environment variables for the database service.

Spring Boot
services:
  db:
    environment:
      - [1]=postgres
      - [2]=password123
Drag options to blanks, or click blank then click option'
APOSTGRES_USER
BPOSTGRES_PASSWORD
CDB_USER
DDB_PASS
Attempts:
3 left
💡 Hint
Common Mistakes
Using custom variable names instead of the expected ones.
Swapping user and password variable names.
5fill in blank
hard

Fill all three blanks to define a build context, Dockerfile, and container name for the app service.

Spring Boot
services:
  app:
    build:
      context: [1]
      dockerfile: [2]
    container_name: [3]
Drag options to blanks, or click blank then click option'
A./app
BDockerfile
Cspringboot_app
D./src
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong folder paths for context.
Using incorrect Dockerfile names.
Not naming the container or using invalid names.