Docker Compose - docker/genai-stack

Docker Compose is a tool for defining and running multi-container Docker applications. It uses a YAML file, called docker-compose.yml, to configure the application’s services, networks, and volumes. With Compose, you can create and start all the services from the configuration with a single command.

The docker-compose.yml file is at the heart of Docker Compose. It defines the services, their dependencies, and the configuration for each service. Here is an example of a simple docker-compose.yml file:

version: '3'
services:
web:
build: .
ports:
- "5000:5000"
redis:
image: "redis:alpine"

In this example, the docker-compose.yml file defines two services: web and redis. The web service is built from the Dockerfile in the current directory, and its port 5000 is mapped to the host’s port 5000. The redis service uses the redis:alpine Docker image.

To start the services defined in the docker-compose.yml file, you can run the following command:

$ docker compose up

This command creates and starts the services defined in the docker-compose.yml file. If you want to build the images before starting the services, you can use the --build flag:

$ docker compose up --build

If you want to automatically rebuild the services when the docker-compose.yml file changes, you can use the --watch flag:

$ docker compose up --watch

To stop the services, you can use the following command:

$ docker compose down

This command stops and removes the services and their networks and volumes.

For more information about Docker Compose, you can refer to the official documentation.

The GenAI Stack, introduced in this blog post, is an example of a complex Docker Compose application. It includes several services, such as Redis, PostgreSQL, FastAPI, and Grafana, that work together to provide a complete AI/ML development environment. The docker-compose.yml file for the GenAI Stack is available in the GitHub repository.

To learn more about the GenAI Stack, you can refer to the official documentation.

Sources: