Skip to main content

Docker Compose

Metadata

This task is complementary to the lectures and lists tasks and information for the in-lesson tasks.

## Prerequisites Open your spring-starer, which already has tests and an empty endpoint.

In case you did not do that, use this.

Get started

Create file

Create a new file docker-compose.yml in the root directory.

Add command

Translate this docker run command into a compose file:

docker build -t spring-starter . && run --name spring-starter -p 8080:8080 spring-starter

Here is an empty compose file and an official example:

version: "3.0"
services:
...

Hint: Only four lines are missing (name, build and ports).

Solution

The fast way 🚁