Building a Rasa Assistant in Docker
Building a Rasa Assistant in Docker
If you don’t have a Rasa project yet, you can build one in Docker without having to install Rasa Open Source on your local machine. If you already have a model you’re satisfied with, see Deploying Your Rasa Assistant to learn how to deploy your model.
- Installing Docker
- Setting up your Rasa Project
- Talking to Your Assistant
- Training a Model
- Customizing your Model
- Deploying your Assistant
Installing Docker
If you’re not sure if you have Docker installed, you can check by running:
docker -v # Docker version 18.09.2, build 6247962If Docker is installed on your machine, the output should show you your installed versions of Docker. If the command doesn’t work, you’ll have to install Docker. See Docker Installation for details.
Setting up your Rasa Project
Just like in the tutorial, you’ll use the rasa init command to create a project. The only difference is that you’ll be running Rasa inside a Docker container, using the image rasa/rasa. To initialize your project, run:
docker run -v $(pwd):/app rasa/rasa:1.10.24-full init --no-prompt
What does this command mean?
-v $(pwd):/appmounts your current working directory to the working directory in the Docker container.rasa/rasais the name of the docker image to run.
Running this command will produce a lot of output. What happens is:
- a Rasa project is created
- an initial model is trained using the project’s training data.
To check that the command completed correctly, look at the contents of your working directory:
ls -1
The initial project files should all be there, as well as a models directory that contains your trained model.
Talking to Your Assistant
To talk to your newly-trained assistant, run this command:
docker run -it -v $(pwd):/app rasa/rasa:1.10.24-full shell
Training a Model
If you edit the NLU or Core training data or edit the config.yml file, you’ll need to retrain your Rasa model. You can do so by running:
docker run -v $(pwd):/app rasa/rasa:1.10.24-full train --domain domain.yml --data data --out models
Customizing your Model
Choosing a Tag
All rasa/rasa image tags start with a version number. The current version is 1.10.24. The tags are:
{version}{version}-full{version}-spacy-en{version}-spacy-de{version}-mitie-en
Adding Custom Components
If you are using a custom NLU component or policy in your config.yml, you have to add the module file to your Docker container.
Adding Custom Actions
To create more sophisticated assistants, you will want to use Custom Actions.
Deploying your Assistant
Work on your bot until you have a minimum viable assistant that can handle your happy paths. After that, you’ll want to deploy your model to get feedback from real test users.