Docker | Not able to run rasa

Hi, I am trying to run docker in a container. However not able to make it run. I am following the steps documented here - Building a Rasa Assistant in Docker.

However when I run the first command itself (i also tried with sudo docker) as described in the documentation:

docker run -v $(pwd):/app rasa/rasa init --no-prompt

i am getting the following error:

(rasa) utsyk@utsulp:~/dockerProjects/bot/support_bot$ sudo docker run -v $(pwd):/app rasa/rasa init --no-prompt
2022-05-15 09:23:47 WARNING  rasa.utils.common  - Failed to write global config. Error: [Errno 13] Permission denied: '/app/.config'. Skipping.
Warning: Output is not to a terminal (fd=1).
Warning: Input is not to a terminal (fd=0).
Welcome to Rasa! 🤖

To get started quickly, an initial project will be created.
If you need some help, check out the documentation at https://rasa.com/docs/rasa.

Traceback (most recent call last):
  File "/usr/lib/python3.8/distutils/file_util.py", line 41, in _copy_file_contents
    fdst = open(dst, 'wb')
PermissionError: [Errno 13] Permission denied: './credentials.yml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/opt/venv/lib/python3.8/site-packages/rasa/__main__.py", line 119, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/opt/venv/lib/python3.8/site-packages/rasa/cli/scaffold.py", line 238, in run
    init_project(args, path)
  File "/opt/venv/lib/python3.8/site-packages/rasa/cli/scaffold.py", line 130, in init_project
    create_initial_project(".")
  File "/opt/venv/lib/python3.8/site-packages/rasa/cli/scaffold.py", line 139, in create_initial_project
    copy_tree(scaffold_path(), path)
  File "/usr/lib/python3.8/distutils/dir_util.py", line 174, in copy_tree
    copy_file(src_name, dst_name, preserve_mode,
  File "/usr/lib/python3.8/distutils/file_util.py", line 151, in copy_file
    _copy_file_contents(src, dst)
  File "/usr/lib/python3.8/distutils/file_util.py", line 43, in _copy_file_contents
    raise DistutilsFileError(
distutils.errors.DistutilsFileError: could not create './credentials.yml': Permission denied

I am running on Ubuntu 20.04:

NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

you need to mention the image version

docker run -v $(pwd):/app rasa/rasa:3.1.0-full init --no-prompt

or

docker run -v $(pwd):/app rasa/rasa:3.0.0-full init --no-prompt

or

docker run -v $(pwd):/app rasa/rasa:2.8.15 init --no-prompt

Solution:

Add --user 1000 or 1001 it should solve.

docker run --user 1000 -it -v $(pwd):/app rasa/rasa init --no-prompt

Check docker hub for the image release version, I know there can be docker pull rasa/rasa but try the above and do check docker ps its running or not. I will highly recommend to use docker-compose else you always run the commands manually. If you need more help do tag me.

Thanks @nik202 . –user option did the trick.

@utsuk.prani please close this thread for others and good luck!