One file, two services
Compose is for running a small stack, not just one container. In this lesson, your stack has an app service built from your Dockerfile and a database service pulled from an image.
The app talks to the database by service name, like db. Compose creates the network for you.
What Compose adds
Your Dockerfile says how to build your app image. compose.yaml says which containers run together, which ports are published, and which volumes keep data.
Use docker compose, with a space. Older tutorials may show docker-compose with a hyphen. Treat that as old style.