# Deploy Rasa In Docker

**URL:** <https://forum.rasa.com/t/deploy-rasa-in-docker/45732>\
**Category:** Rasa Open Source\
**Created:** [July 14, 2021, 8:35am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732 "2021-07-14T08:35:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 8:35am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/1 "2021-07-14T08:35:25Z")

</div>

Hi all, I’m new to Rasa and Docker. I have created a bot that asks user information and it stores in the database and also it fetches details from the database. I’m using postgresql for database. I want to deploy my rasa project in docker. Could anyone explain more in detail how to do that. thanks in advance. @jonathanpwheat

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 14, 2021, 8:40am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/2 "2021-07-14T08:40:53Z")

</div>

@Shan Are you using window, mac or Ubuntu.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 8:42am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/3 "2021-07-14T08:42:10Z")

</div>

@nik202 Windows

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 14, 2021, 8:45am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/4 "2021-07-14T08:45:13Z")

</div>

@Shan Do you have any prior docker experience?

@Shan Install docker desktop, create the rasa project in VS code. Check the rasa docker image.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 8:49am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/5 "2021-07-14T08:49:50Z")

</div>

@nik202 I don’t have. Anyway I try that and get back to you.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 14, 2021, 8:51am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/6 "2021-07-14T08:51:49Z")

</div>

@Shan I will encourage please do some basic, beginner course or tutorial on docker, at least to know what are the process and commands and syntax used and for what process, else it will be very complex for you. This is only my suggestion, take it or leave it. Good Luck!

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 1:00pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/7 "2021-07-14T13:00:13Z")

</div>

Hi @nik202

Dockerfile

FROM rasa/rasa  
COPY . /chatbot  
WORKDIR /chatbot  
RUN pip install -r requirements.txt  
USER root  
COPY ./actions /app/actions  
USER 1001

this is my dockerfile is this correct? and I have a doubt what are libraries I should add in requirements.txt file.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 14, 2021, 1:02pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/8 "2021-07-14T13:02:48Z")

</div>

@Shan No, you need to create the docker-compose file for the rasa.@Shan If you are using action.py for custom action and you using some outside libraries then you need to add that in requirenments.txt else you will see the error in logs you can add that.@Shan check this thread for your reference only [Error starting action server on Docker - #5 by BELIEVEIT](http://forum.rasa.com/t/error-starting-action-server-on-docker/45056/5)@Shan If further issue do let us know.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 1:07pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/9 "2021-07-14T13:07:23Z")

</div>

@nik202 how can I contact you privately.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 1:27pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/11 "2021-07-14T13:27:50Z")

</div>

@nik202 okay.do let me know when you are free

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 5:11pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/13 "2021-07-14T17:11:50Z")

</div>

Hi @nik202. Could you explain more step by step instructions. Should I create a docker image before docker-compose?

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 14, 2021, 5:45pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/15 "2021-07-14T17:45:41Z")

</div>

@nik202 ?

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 15, 2021, 5:12am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/17 "2021-07-15T05:12:00Z")

</div>

@nik202 Don’t get me wrongly I was busy when you replied. this is my mail id [shanthoshvijay16@gmail.com](mailto:shanthoshvijay16@gmail.com)

what I understood for deployment from blogs and docker videos and tried like this.

First step: I have to create a docker image contains project source and requirements.

Dockerfile

```
FROM rasa/rasa  
COPY . /chatbot  
WORKDIR /chatbot  
RUN pip install -r requirements.txt  
USER root  
COPY ./actions /app/actions
USER 1001     

```

requirements.txt

```
pyaml  
flask   
requests  
spacy  
rasa-nlu   
rasa-core   
rasa-core-sdk  

```

Second step: Create Docker-compose.yml

```
version: "3.0"  
services:  
  rasa:  
    image: rasa/rasa:2.6.3-full  
    ports:   
      - 5005:5005  
    volumes:   
      - ./:/app  
    command:  
      - run  
      - -m  
      - models   
      - --enable-api  
      - --cors   
      - "*"  
      - --debug   
  action_server:  
    image: rasa/rasa_core_sdk:latest  
    ports:  
      - 5055:5055  
    volumes:  
      - ./actions:/app/actions  
   command:  
     - rasa  
     - run  
     - actions  

```

could you tell me right flow for deployment.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 15, 2021, 11:48am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/18 "2021-07-15T11:48:26Z")

</div>

@Shan Is above one is running? @Shan Please delete your emailD from above post.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 15, 2021, 11:55am UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/19 "2021-07-15T11:55:47Z")

</div>

this is my new Dockerfile

FROM rasa/rasa  
COPY . /Bot  
WORKDIR /Bot  
COPY ./actions /app/actions  
USER 1001  
CMD [“init”]

I ran this command “docker build --tag bot .” it creates an image and I opened image in docker desktop and ran but it shows this error.

UserWarning: The model at ‘models’ could not be loaded. Error: \<class ‘rasa.nlu.model.UnsupportedModelError’\>: The model version is trained using Rasa Open Source 2.6.3 and is not compatible with your current installation (2.8.0). This means that you either need to retrain your model or revert back to the Rasa version that trained the model to ensure that the versions match up again.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 15, 2021, 12:00pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/20 "2021-07-15T12:00:36Z")

</div>

I tried with docker-compose.yml and ran this command " docker-compose up"

version: “3.0”

services:  
rasa:  
container\_name: rasa-server  
image: rasa/rasa:latest-full  
ports:  
- 5005:5005  
volumes:  
- ./:/app  
command:  
- run  
- --cors  
- “\*”  
- --enable-api  
- --log-file  
- out.log  
depends\_on:  
- action-server action-server:  
container\_name: rasa-action-server  
image: rasa/rasa-sdk:latest  
volumes:  
- ./actions:/app/actions  
ports:  
- “5055:5055”

but it shows this error

`rasa-server | /opt/venv/lib/python3.8/site-packages/rasa/shared/utils/io.py:97: UserWarning: The model at 'models' could not be loaded. Error: <class 'rasa.nlu.model.UnsupportedModelError'>: The model version is trained using Rasa Open Source 2.6.3 and is not compatible with your current installation (2.8.0). This means that you either need to retrain your model or revert back to the Rasa version that trained the model to ensure that the versions match up again.`

`rasa-server | /opt/venv/lib/python3.8/site-packages/rasa/shared/utils/io.py:97: UserWarning: Agent could not be loaded with the provided configuration. Load default agent without any model.`

`rasa-action-server | import psycopg2`

`rasa-action-server | ModuleNotFoundError: No module named 'psycopg2'`

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 15, 2021, 12:18pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/21 "2021-07-15T12:18:52Z")

</div>

@Shan check Dockerfiles for rasa and rasa-sdk, how in that we have train the model, used requirement.txt ok you doing in right direction.

For error:

1. you previous model is trained based on rasa 2.6.3 and your image is latest, rather train the model. with latest or change the image to 2.6.3 from latest ok?
2. in action.py you used psycopg rather delete this import or add psycopg2 in requirement file.

I hope it make sense now.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://forum.rasa.com/u/Shan)\
**Post date:** [July 15, 2021, 3:29pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/22 "2021-07-15T15:29:47Z")

</div>

I updated my rasa version to latest and then I ran the command docker build --tag bot . and I ran rasa shell it works but not able to connect action server.

---

<div class="post-metadata">

**Author:** ![jonathanpwheat](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/jonathanpwheat/32/4880_2.png) [@jonathanpwheat](https://forum.rasa.com/u/jonathanpwheat)\
**Post date:** [July 15, 2021, 4:24pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/23 "2021-07-15T16:24:58Z")

</div>

I’m no Docker pro, and interestingly don’t use it at all now, but I did write up a pretty super basic tutorial over a year ago about getting rasa setup with Docker. You can take a look here - [Using Docker with Rasa for development - DEV Community 👩‍💻👨‍💻](https://dev.to/jonathanpwheat/using-docker-with-rasa-for-development-1c3h)

Probably doesn’t follow best practices and versions may be old, but there might be a tid-bit in there that may help figure out why you can’t talk to the action sever.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 15, 2021, 4:38pm UTC](https://forum.rasa.com/t/deploy-rasa-in-docker/45732/24 "2021-07-15T16:38:27Z")

</div>

@Shan change the action-server or whatever you had mentioned in docker file in endpoint.yml from localhost → action-server. Build and try.

[Next page](https://forum.rasa.com/t/deploy-rasa-in-docker/45732.md?page=2)
