如何设置从镜像ubuntu安装docker的python路径



我从ubuntu:18.04制作了映像并安装了python。

然而,当我在docker写时

command: python manage.py runserver

它显示了路径错误。

也许我没有设定路线??

但是我如何设置docker用户的路径??

ERROR: for django  Cannot start service django: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: "python": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.

FROM ubuntu:18.04
ENV PYTHONUNBUFFERED 1
RUN apt-get -y update
RUN apt-get -y install emacs wget
RUN apt-get -y install apache2-dev mysql-client
RUN apt-get -y install mysql-server libmysqlclient-dev
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get install -y python3.7
RUN apt-get install -y python-pip
RUN pip install uwsgi django mysqlclient tensorflow_hub django-mysql django-extensions djangorestframework django-filter requests_oauthlib mecab-python3 neologdn gensim janome --no-input
RUN pip install keras tensorflow==1.14.0 --no-cache-dir --no-input
RUN mkdir /code
WORKDIR /code
ADD ./src /code/

你可以用两种方法解决这个问题(对我有用(:

在docker撰写添加:

command: bash -c 'python manage.py runserver'

或者您可以在Dockerfile:中添加CMD命令

CMD: python manage.py runserver

最新更新