Home Explore Blog CI



docker

1st chunk of `content/guides/rag-ollama/containerize.md`
2bdb02166be14a44f3579eb2a5ecbc0b90149a8924f9b59500000001000008e9
---
title: Containerize a RAG application
linkTitle: Containerize your app
weight: 10
keywords: python, generative ai, genai, llm, ollama, containerize, initialize, qdrant
description: Learn how to containerize a RAG application.
aliases:
  - /guides/use-case/rag-ollama/containerize/
---

## Overview

This section walks you through containerizing a RAG application using Docker.

> [!NOTE]
> You can see more samples of containerized GenAI applications in the [GenAI Stack](https://github.com/docker/genai-stack) demo applications.

## Get the sample application

The sample application used in this guide is an example of RAG application, made by three main components, which are the building blocks for every RAG application. A Large Language Model hosted somewhere, in this case it is hosted in a container and served via [Ollama](https://ollama.ai/). A vector database, [Qdrant](https://qdrant.tech/), to store the embeddings of local data, and a web application, using [Streamlit](https://streamlit.io/) to offer the best user experience to the user.

Clone the sample application. Open a terminal, change directory to a directory that you want to work in, and run the following command to clone the repository:

```console
$ git clone https://github.com/mfranzon/winy.git
```

You should now have the following files in your `winy` directory.

```text
├── winy/
│ ├── .gitignore
│ ├── app/
│ │ ├── main.py
│ │ ├── Dockerfile
| | └── requirements.txt
│ ├── tools/
│ │ ├── create_db.py
│ │ ├── create_embeddings.py
│ │ ├── requirements.txt
│ │ ├── test.py
| | └── download_model.sh
│ ├── docker-compose.yaml
│ ├── wine_database.db
│ ├── LICENSE
│ └── README.md
```

## Containerizing your application: Essentials

Containerizing an application involves packaging it along with its dependencies into a container, which ensures consistency across different environments. Here’s what you need to containerize an app like Winy :

1. Dockerfile: A Dockerfile that contains instructions on how to build a Docker image for your application. It specifies the base image, dependencies, configuration files, and the command to run your application.

Title: Containerizing a RAG Application with Docker
Summary
This section guides you through containerizing a RAG application using Docker, with a focus on a sample application consisting of a Large Language Model (Ollama), a vector database (Qdrant), and a Streamlit web application. The guide explains how to clone the sample application and highlights the essential components needed for containerization, particularly the Dockerfile, which contains instructions on building the Docker image, specifying dependencies, configuration files, and the command to run the application.