git clone https://github.com/bossan/docker-workshop
Look at the docker-compose.yml file.
It contains the following information:
version
The version of the docker-compose file format we want to use. There are different versions so it is wise to specify which version you want to use in case there is an update.
services
The services (containers) we want to run. In this case it is:
volumes
Volumes are a place to store data. We use it to store the data from our database. This way we can keep the data even if the container with the database is deleted or upgraded.
Run the following command to start the services:
docker compose up -d
compose
because we want to use a docker-compose fileup
to start the services-d
to run it in ‘detached’ mode (runs in the background)Run the following command to see which containers are currently running:
docker ps
Go to http://localhost:3000 to use the app. You can use the Swagger UI to interact with the API.
Using play-with-docker? Instead of opening localhost:3000 you should click on the “OPEN PORT” button and fill in
3000
. This should open a new page with the application.
You can stop and REMOVE all containers with:
docker compose down
Or you can just stop them (without removing) using:
docker compose stop