Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCKER: Outdated Dockerfile custom dependencies documentation #157

Closed
kremio opened this issue Mar 8, 2020 · 5 comments
Closed

DOCKER: Outdated Dockerfile custom dependencies documentation #157

kremio opened this issue Mar 8, 2020 · 5 comments
Labels
type:question 💬 Question around usage, examples

Comments

@kremio
Copy link

kremio commented Mar 8, 2020

Rasa version:
1.8.0
Rasa SDK version:
1.8.0
Python version:
not relevant
Operating system (windows, osx, ...):
not relevant
Issue:
With the current Docker image of RASA SDK, installing custom Python dependencies using the instructions provided on https://hub.docker.com/r/rasa/rasa-sdk does not work.
For instance, building the following Dockerfile:

FROM rasa/rasa-sdk:1.8.0
RUN pip --no-cache-dir install python-dateutil

results in the following pip error:

Collecting python-dateutil
  Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting six>=1.5
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: six, python-dateutil
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/venv/lib/python3.6/site-packages/six.py'
Consider using the `--user` option or check the permissions.

The reason is that the RASA SDK Dockerfile switches the build environment to a user with insufficient privileges:

USER 1001

One possible solution is to sandwich the RUN pip commands between USER root and USER 1001, so the previous broken Dockerfile becomes:

FROM rasa/rasa-sdk:1.8.0
USER root
RUN pip --no-cache-dir install python-dateutil
USER 1001

Error (including full traceback):


Command or request that led to error:


Content of configuration file (config.yml) (if relevant):

Content of domain file (domain.yml) (if relevant):

Contents of actions.py (if relevant):

@kremio kremio added the type:bug 🐛 Something isn't working label Mar 8, 2020
@sara-tagger
Copy link

Thanks for the issue, @dakshvar22 will get back to you about it soon!

You may find help in the docs and the forum, too 🤗

@wochinge
Copy link
Contributor

wochinge commented Mar 11, 2020

@kremio Since version 1.8.0 the image does not longer run as root user (following Docker best practices). In order to install your dependencies you have to switch to the root user before installing the dependencies.

FROM rasa/rasa-sdk:1.8.0
# Switch to root to install dependencies
USER root
RUN pip --no-cache-dir install python-dateutil

# Switch back to non-root user
USER 1001

@wochinge wochinge added type:question 💬 Question around usage, examples and removed type:bug 🐛 Something isn't working labels Mar 11, 2020
@wochinge
Copy link
Contributor

I'll also clarify that in the docs! :-)

@ankitbansal811
Copy link

in the USER ROOT step root is case sensitive. Please use USER root

FROM rasa/rasa-sdk:1.8.0
# Switch to root to install dependencies
USER **root**
RUN pip --no-cache-dir install python-dateutil

# Switch back to non-root user
USER 1001`

@wochinge
Copy link
Contributor

Thanks @ankitbansal811 🚀 Too many CAPS 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question 💬 Question around usage, examples
Projects
None yet
Development

No branches or pull requests

4 participants