diff --git a/changelog/5404.doc.rst b/changelog/5404.doc.rst new file mode 100644 index 000000000000..d27dc40af44c --- /dev/null +++ b/changelog/5404.doc.rst @@ -0,0 +1,5 @@ +Explain how to run commands as ``root`` user in Rasa SDK Docker images since version +``1.8.0``. Since version ``1.8.0`` the Rasa SDK Docker images does not longer run as +``root`` user by default. For commands which require ``root`` user usage, you have to +switch back to the ``root`` user in your Docker image as described in +:ref:`deploying-your-rasa-assistant_custom-dependencies`. diff --git a/docs/user-guide/how-to-deploy.rst b/docs/user-guide/how-to-deploy.rst index 6b846998ef81..b2142365427e 100644 --- a/docs/user-guide/how-to-deploy.rst +++ b/docs/user-guide/how-to-deploy.rst @@ -332,7 +332,7 @@ Then build a custom action using the Rasa SDK, e.g.: def name(self): return "action_joke" - def run(self, dispatcher, tracker, domain): + async def run(self, dispatcher, tracker, domain): request = requests.get('http://api.icndb.com/jokes/random').json() # make an api call joke = request['value']['joke'] # extract a joke from returned json response dispatcher.utter_message(text=joke) # send the message back to the user @@ -382,6 +382,8 @@ Add this to your ``endpoints.yml`` (if it does not exist, create it): Run ``docker-compose up`` to start the action server together with Rasa. +.. _deploying-your-rasa-assistant_custom-dependencies: + Adding Custom Dependencies ************************** @@ -396,6 +398,10 @@ image and add your custom dependencies. For example: # Extend the official Rasa SDK image FROM rasa/rasa-sdk:latest + # The Rasa SDK image runs as non-root user by default. Hence, you have to switch + # back to the `root` user if you want to install additional dependencies. + USER root + # Add a custom system library (e.g. git) RUN apt-get update && \ apt-get install -y git @@ -403,6 +409,9 @@ image and add your custom dependencies. For example: # Add a custom python library (e.g. jupyter) RUN pip install --no-cache-dir jupyter + # Switch back to a non-root user + USER 1001 + You can then build the image via the following command, and use it in your ``docker-compose.yml`` instead of the ``rasa/rasa-sdk`` image.