2

我一直在尝试创建一个 docker 映像来运行 fbprohet 和 streamlit。当我运行 docker run 命令时,出现以下错误。

我已经坚持这个问题好几天了。任何帮助,将不胜感激。

谢谢,

$ docker run <image-id> streamlit hello
Generate machine-id
Traceback (most recent call last):
  File "/usr/local/bin/streamlit", line 5, in <module>
    from streamlit.cli import main
  File "/usr/local/lib/python3.7/site-packages/streamlit/__init__.py", line 74, in <module>
    subprocess.run(["sudo", "dbus-uuidgen", "--ensure"])
  File "/usr/local/lib/python3.7/subprocess.py", line 488, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/local/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'sudo': 'sudo'

下面的 Dockerfile

FROM python:3.7-alpine

WORKDIR /workspace

COPY requirements.txt .

RUN apk add --no-cache python3 python3-dev build-base libffi-dev openssl-dev curl krb5-dev linux-headers zeromq-dev jpeg-dev zlib-dev && \
    python3 -m ensurepip && \
    rm -r /usr/lib/python*/ensurepip && \
    pip3 install --upgrade pip setuptools && \
    if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
    if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
    rm -r /root/.cache


RUN apk --update add --no-cache gcc freetype-dev libpng-dev

RUN apk add --no-cache --virtual .build-deps \
    musl-dev \
    g++


RUN pip install -r requirements.txt --no-cache-dir 

# removing dependencies
RUN apk del .build-deps


EXPOSE 9999
4

1 回答 1

1

从错误消息和您的 Dockerfile 来看,Streamlit 似乎假定 sudo 在运行时可用。尝试添加sudo到您的apk add陈述中。

于 2020-05-18T17:14:12.203 回答