Watchdog error when running streamlit in docker

I get the following error when running streamlit in Docker. Any ideas?

Traceback (most recent call last):
  File "/usr/local/bin/streamlit", line 8, in <module>
  File "/usr/local/lib/python3.10/site-packages/click/", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/site-packages/click/", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/streamlit/", line 205, in main_run
    _main_run(target, args, flag_options=kwargs)
  File "/usr/local/lib/python3.10/site-packages/streamlit/", line 240, in _main_run, command_line, args, flag_options)
  File "/usr/local/lib/python3.10/site-packages/streamlit/", line 362, in run
  File "/usr/local/lib/python3.10/site-packages/streamlit/", line 338, in _install_pages_watcher
  File "/usr/local/lib/python3.10/site-packages/streamlit/watcher/", line 154, in watch_dir
    return _watch_path(
  File "/usr/local/lib/python3.10/site-packages/streamlit/watcher/", line 129, in _watch_path
  File "/usr/local/lib/python3.10/site-packages/streamlit/watcher/", line 92, in __init__
  File "/usr/local/lib/python3.10/site-packages/streamlit/watcher/", line 170, in watch_path = self._observer.schedule(
  File "/usr/local/lib/python3.10/site-packages/watchdog/observers/", line 302, in schedule
  File "/usr/local/lib/python3.10/site-packages/watchdog/utils/", line 93, in start
  File "/usr/local/lib/python3.10/site-packages/watchdog/observers/", line 118, in on_thread_start
    self._inotify = InotifyBuffer(path,
  File "/usr/local/lib/python3.10/site-packages/watchdog/observers/", line 35, in __init__
    self._inotify = Inotify(path, recursive)
  File "/usr/local/lib/python3.10/site-packages/watchdog/observers/", line 167, in __init__
    self._add_dir_watch(path, recursive, event_mask)
  File "/usr/local/lib/python3.10/site-packages/watchdog/observers/", line 372, in _add_dir_watch
    self._add_watch(full_path, mask)
  File "/usr/local/lib/python3.10/site-packages/watchdog/observers/", line 386, in _add_watch
  File "/usr/local/lib/python3.10/site-packages/watchdog/observers/", line 406, in _raise_error
    raise OSError(err, os.strerror(err))
FileNotFoundError: [Errno 2] No such file or directory
ted with code 1

The Dockerfile:

FROM python:3.10

COPY requirements.txt .

RUN pip install -r requirements.txt



CMD [ "streamlit", "run", ""]

The file:

import streamlit as st


The requirements.txt:

streamlit >= 1.10.0


  • Running the streamlit run command locally (not inside Docker) works perfectly fine.
  • Running streamlit hello inside Docker does also work without any problems.
  • I tried different python versions (3.6, 3.8, 3.9) none of them worked, same with lower streamlit versions

I haven’t seen this error yet, and i use docker quite often for local testing of streamlit apps, before deploying them on streamlit cloud. :thinking:
I use python:3.7-slim and python:3.8-slim and python:3.9-slim as base images.

Can you share a link to your public github repo?

Hey, thanks for the response. Unfortunately the repository isn’t public at the moment.

Like you I’ve never seen this error before and I’ve also deployed multiple dashboard via docker before, but on different systems (which should be more or less irrelevant thanks to docker).

When I run the container on my home server I get the same error, so I think it’s not related to the system

Don’t ask me why, but adding WORKDIR /src/app to my Dockerfile and adjusting the paths for COPY and the volumes did the trick.

All this is documented here:

It’s definately a regression from 1.09->1.10, but the pages does note the “workdir” workaournd.

1 Like