Permission denied when using Docker

I’m want to use interactive command but it return me this error :

[root@wqya1726 chatbot_rasa]# rasa interactive
Nothing changed. You can use the old model stored at '/app/models/20191114-130310.tar.gz'.
2019-11-14 13:30:51 INFO     rasa.nlu.components  - Added 'SpacyNLP' to component cache. Key 'SpacyNLP-fr'.
2019-11-14 13:30:51.777254: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
Bot loaded. Visualisation at http://localhost:5006/visualization.html.
Type a message and press enter (press 'Ctr-c' to exit).
Processed Story Blocks: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 2/2 [00:00<00:00, 3015.32it/s, # trackers=1]
2019-11-14 13:30:52 ERROR    rasa.core.training.interactive  - An exception occurred while recording messages.
Traceback (most recent call last):
  File "/build/lib/python3.6/site-packages/rasa/core/training/interactive.py", line 1399, in record_messages
    await _plot_trackers(sender_ids, plot_file, endpoint)
  File "/build/lib/python3.6/site-packages/rasa/core/training/interactive.py", line 1338, in _plot_trackers
    write_dot(graph, output_file)
  File "</build/lib/python3.6/site-packages/decorator.py:decorator-gen-904>", line 2, in write_dot
  File "/build/lib/python3.6/site-packages/networkx/utils/decorators.py", line 214, in _open_file
    fobj = _dispatch_dict[ext](path, mode=mode)
PermissionError: [Errno 13] Permission denied: 'story_graph.dot'
2019-11-14 13:30:52 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished coro=<_serve_application.<locals>.run_interactive_io() done, defined at /build/lib/python3.6/site-packages/rasa/core/training/interactive.py:1452> exception=PermissionError(13, 'Permission denied')>
Traceback (most recent call last):
  File "/build/lib/python3.6/site-packages/rasa/core/training/interactive.py", line 1459, in run_interactive_io
    sender_id=uuid.uuid4().hex,
  File "/build/lib/python3.6/site-packages/rasa/core/training/interactive.py", line 1399, in record_messages
    await _plot_trackers(sender_ids, plot_file, endpoint)
  File "/build/lib/python3.6/site-packages/rasa/core/training/interactive.py", line 1338, in _plot_trackers
    write_dot(graph, output_file)
  File "</build/lib/python3.6/site-packages/decorator.py:decorator-gen-904>", line 2, in write_dot
  File "/build/lib/python3.6/site-packages/networkx/utils/decorators.py", line 214, in _open_file
    fobj = _dispatch_dict[ext](path, mode=mode)
PermissionError: [Errno 13] Permission denied: 'story_graph.dot'

I generated the Docker image from Dockerfile :

# Create common base stage
FROM python:3.6-slim as base

WORKDIR /build

# Configurer le proxy http et https pour avoir accès aux repository et dépôt github
ENV http_proxy='http://pxjr389:dUw6t9P@surf-sccc.pasi.log.intra.laposte.fr:8080'
ENV https_proxy='http://pxjr389:dUw6t9P@surf-sccc.pasi.log.intra.laposte.fr:8080'

# Create virtualenv to isolate builds
RUN python -m venv /build

# Install common libraries
RUN apt-get update -qq \
 && apt-get install -y --no-install-recommends \
    # required by psycopg2 at build and runtime
    libpq-dev \
     # required for health check
    curl \
 && apt-get autoremove -y

# Make sure we use the virtualenv
ENV PATH="/build/bin:$PATH"

# Stage to build and install everything
FROM base as builder

WORKDIR /src

# Install all required build libraries
RUN apt-get update -qq \
 && apt-get install -y --no-install-recommends \
    build-essential \
    wget \
    openssh-client \
    graphviz-dev \
    pkg-config \
    git-core \
    openssl \
    libssl-dev \
    libffi6 \
    libffi-dev \
    libpng-dev

# Upgrade de pip
RUN pip install --upgrade pip

# Spacy FR installation 
RUN pip install https://github.com/explosion/spacy-models/releases/download/fr_core_news_sm-2.2.0/fr_core_news_sm-2.2.0.tar.gz#egg=fr_core_news_sm==2.2.0 --no-cache-dir > /dev/null \
	&& python -m spacy link fr_core_news_sm fr

# Copy only what we really need
COPY README.md .
COPY setup.py .
COPY setup.cfg .
COPY MANIFEST.in .
COPY requirements.txt .

# Install Rasa and its dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Install Rasa as package
COPY rasa ./rasa
RUN pip install .[sql]

# Runtime stage which uses the virtualenv which we built in the previous stage
FROM base AS runner

# Copy virtualenv from previous stage
COPY --from=builder /build /build

WORKDIR /app

# Create a volume for temporary data
VOLUME /tmp

# Make sure the default group has the same permissions as the owner
RUN chgrp -R 0 . && chmod -R g=u .

# Don't run as root
USER 1001

EXPOSE 5005

ENTRYPOINT ["rasa"]
CMD ["--help"]

There is a problem in Dockerfile ? A permission to change or other thing ?

Thanks.

This looks like a permissions issue on the file, since you are using a different user than root I’m wondering if maybe that could be the potential issue and it doesn’t have the proper permissions to the file or folder to create it. When you do the interactive learning it creates that dot file.

I’m using root to launch the container rasa.

But i saw that the user in the container of rasa/rasa:latest is not root but other.

I forgot to you mentioned ^

I changed the permissions of the file with chmod a+rwx story_graph.dot and it working well now.

thks.

1 Like

Awesome glad you got it going.

1 Like

I am facing the same error of permission denied. Please can you help with this.