Dockerizing my rasa chatbot application that has botfront

Actually, I was saying can I create and host docker container having my rasa code so that anytime if anyone just opens index.html, the chatbot will work.

@mangesh Containers and there images are on docker hub so they will be live.

Okay, and if I have created my rasa application already without docker, do I need to create that project again from scratch using docker?

Oh, I guess I need to learn more about it :sweat_smile:

@mangesh Yeps, and to deal with Rasa-webchat GUI is not easy task it is developed on React JS and node.js, as experts like me on React and Node not trying to take a nightmare :stuck_out_tongue:


Please find the steps as per our discussion:

For Wordpress:

  1. For creating a docker image for Wordpress site for deployment purpose only; running on localhost 8000 Quick Wordpress Setup With Docker - YouTube
  2. Deploying rasa on Wordpress site please follow this link DEPLOY RASA CHATBOT TO WORDPRESS WEBSITE | WORDPRESS | INNOVATE YOURSELF - YouTube

For Docker Environment:

  1. Create the Dockerhub ID from

  2. Create a Docker image for action server by the name Dockerfile (blue logo), if you have any requirements, please make a requirement.txt file in the same folder with all the packages in it.

Snippet code:

FROM rasa/rasa-sdk:2.7.0
COPY requirement.txt requirement.txt
USER root
RUN pip install -r requirement.txt
USER 1001

Note: If you did not require the requirement.txt file at the moment please commented

  1. Dockerfile for Rasa; create outside the actions folder where other related files by the name Dockerfile (blue logo)

Snippet code:

FROM rasa/rasa:2.7.1
WORKDIR  '/app'
COPY . /app
USER root

RUN  rasa train 

VOLUME /app/models

CMD [ "run","-m","/app/models","--enable-api","--cors","*","--debug" ,"--endpoints", "endpoints.yml", "--log-file", "out.log", "--debug"]

  1. Create the docker-compose.yml file same as you created the above file outside the actions folder by the name docker-compose.yml (pink logo)

Snippet code:

version: '3'
      container_name: "rasa_server"
      user: root
        context:  .
      - "./:/app"
        - "5005:5005"
      container_name: "action_server"
        context: actions
        - ./actions:/app/actions
        - ./data:/app/data
        - 5055:5055

Note: Update in endpoints.yml

  url: 'http://action_server:5055/webhook'

RUN the docker compose

  1. docker-compose up --build or after the build docker-compose up -d please see all the docker related commands.

  2. To check the container running or not docker ps or docker ps -a or docker-compose ps etc

  3. Copy a container from docker to localhost; run the command from terminal (should be in project folder)

docker cp <container ID or name>:"/app" "."

  1. Inspect the rasa server or action server as per need to see the content

docker exec -u root -t -i actions_server /bin/bash

Note: You will be able to run and execute all this whist if you are working on Window, Mac Or Ubuntu. If you have any issue whilst using this solution please mention me :wink:

This is my first ever so long post for any suggestion or solution with such a detail information. I hope it will solve your issue. Good Luck! Bro! Have fun :slight_smile:


@nik202 Thank you for taking efforts. I appreciate it much. If you can just take one final doubt, I’ll close this topic by locking the solution. My purpose is to create a docker image having my project (along with action-server) and deploy it to AWS EC2 (sorry, I didn’t tell you this earlier :frowning: ). Before, you sent me the steps, I was going through this article by rasa → Building a Rasa Assistant in Docker . This doesn’t create a Dockerfile and dockor-compose.yml file which confuses me a lot. Can you help me understand if that article is right for me (I’m asking this because that article is very simple and pretty straightforward, so for a beginner like me, it would be very easy to utilize it.)?

@mangesh Hey! No worries, I already told you as you are using Ubuntu and the tutorial/link you shared using sets of commands, which similar as you told me the youtube video, so you need to remember these sets of commands. On the other hand the solution I suggested, it will automatically run with minimal set of command. The process is same, I told you this in advance. We can talk again later. For, AWS EC2 means they are providing you server nice. It is not related to this post.

@mangesh Check the docker file I suggested and tutorial you will get the comparison.

For example:

$(pwd) → .

/app → /app

rasa/rasa:2.8.0-full → rasa/rasa:latest-full

rasa init → init #in our case we have bot

rasa train → RUN rasa train -c ./config.yml -d ./domain.yml --data ./data --debug

We have eliminate this step

docker network create my-project. as shown in the link

it will automatically connect with rasa server

I hope you got it :wink:

All clear!

@mangesh Note: Keep that in mind the example showing is using 2.8.0 and now both Rasa and Rasa-sdk are 2.8.1, since morning trouble shooting one issue. So, try not use latest-full.

1 Like

@nik202 Hey Now, I have much much more clarity. Thanks man, your step by step solution is a big help for me.

@mangesh Are you able to run on Ubuntu now?

@mangesh Updated some code, do try it please and we will see tomorrow, have a great day.

@nik202 I’m able to now run the project properly with one docker command. Thank you very much!

@mangesh great!

1 Like

@mangesh I am also trying to do the same thing…Could you please help me out

pinging @mangesh can you help him out for the same please.Many thanks in advance.

Sure nik! @CAkhil can you describe how should I help you?

@CAkhil do you want me to repost a final and working template to dockerize rasa chatbot?

Hi @mangesh…I am trying to deploy my rasa chatbot which is running locally now and by using ngrok i am connecting to other channels

Now I want to deploy my bot to azure web app services so that i use that permanent url for communication with mu bot

@CAkhil probably you should create a post with this query so that people who have already done rasa deployment on azure will guide you on what’s the way to go with it. If dockerization is part of the process, you can always ping me.

Hi @mangesh you dockerised your bot and used aws ec2 to get a url right?.. Could u send those final files and steps

@mangesh that would be helpful…please share those final files