---
id: deploying-in-docker-compose
sidebar_label: Deploying a Rasa Assistant in Docker Compose
title: Deploying a Rasa Assistant in Docker Compose
description: Use Docker Compose to deploy a Rasa assistant
---
<!-- this file is version specific, do not use `@site/...` syntax -->
import variables from '../variables.json';

## Installing Docker

If you're not sure if you have Docker installed, you can check by running:

```bash
docker -v && docker-compose -v
# Docker version 18.09.2, build 6247962
# docker-compose version 1.23.2, build 1110ad01
```

If Docker is installed on your machine, the output should show you your installed
versions of Docker and Docker Compose. If the command doesn't work, you'll have to
install Docker.
See [Docker Installation](https://docs.docker.com/install/) for details.

## Configuring Channels

To run your AI assistant in production, don't forget to configure your required
[Messaging and Voice Channels](../messaging-and-voice-channels.mdx) in `credentials.yml`. For example, to add a
REST channel, uncomment this section in the `credentials.yml`:

```yaml-rasa
rest:
  # you don't need to provide anything here - this channel doesn't
  # require any credentials
```

The REST channel will open your bot up to incoming requests at the `/webhooks/rest/webhook` endpoint.

## Using Docker Compose to Run Multiple Services

Docker Compose provides an easy way to run multiple containers together without
having to run multiple commands or configure networks. This is essential when you
want to deploy an assistant that also has an action server.

Start by creating a file called `docker-compose.yml`:

```bash
touch docker-compose.yml
```

Add the following content to the file:

<pre><code parentName="pre" className="language-yaml">
{`version: '3.0'
services:
  rasa:
    image: rasa/rasa:${variables.release}-full
    ports:
      - 5005:5005
    volumes:
      - ./:/app
    command:
      - run`}</code></pre>

The file starts with the version of the Docker Compose specification that you
want to use.
Each container is declared as a `service` within the `docker-compose.yml`.
The first service is the `rasa` service, which runs your Rasa server.

To add the action server, add the image of your action server code. To learn how to deploy
an action server image, see [Building an Action Server Image](../deploy/deploy-action-server.mdx#building-an-action-server-image).

<pre><code parentName="pre" className="language-yaml">
{`version: '3.0'
services:
  rasa:
    image: rasa/rasa:${variables.release}-full
    ports:
      - 5005:5005
    volumes:
      - ./:/app
    command:
      - run
  app:
    image: <image:tag>
    expose: 5055`}</code></pre>

The `expose: 5005` is what allows the `rasa` service to reach the `app` service on that port.
To instruct the `rasa` service to send its action requests to that endpoint, add it to your `endpoints.yml`:

```yaml-rasa
action_endpoint:
  url: http://app:5055/webhook
```

To run the services configured in your `docker-compose.yml` execute:

```bash
docker-compose up
```

You should then be able to interact with your bot via requests to port 5005, on the webhook endpoint that
corresponds to a [configured channel](#configuring-channels):

```bash
curl -XPOST http://localhost:5005/webhooks/rest/webhook \
  -H "Content-type: application/json" \
  -d '{"sender": "test", "message": "hello"}'
```

## Configuring a Tracker Store

By default, all conversations are saved in memory. This means that all
conversations are lost as soon as you restart the Rasa server.
If you want to persist your conversations, you can use a different
[Tracker Store](../tracker-stores.mdx).

To add a tracker store to a Docker Compose deployment, you need to add a new
service to your `docker-compose.yml` and modify the `endpoints.yml` to add
the new tracker store, pointing to your new service. More information about how
to do so can be found in the tracker store documentation:

* [SQLTrackerStore](../tracker-stores.mdx#sqltrackerstore)

* [RedisTrackerStore](../tracker-stores.mdx#redistrackerstore)

* [MongoTrackerStore](../tracker-stores.mdx#mongotrackerstore)

* [Custom Tracker Store](../tracker-stores.mdx#custom-tracker-store)
