gpt4 book ai didi

python -/bin/sh:1:诗歌:找不到

转载 作者:行者123 更新时间:2023-12-02 19:24:19 25 4
gpt4 key购买 nike

我正在尝试使用docker-compose建立一个docker文件,但出现错误:

/bin/sh: 1: poetry: not found
ERROR: Service 'web' failed to build: The command '/bin/sh -c poetry install && bundler install' returned a non-zero code: 127

这是我的docker文件和docker-compose-yml文件:
dockerfile:
FROM python:2.7

ENV LIBRARY_PATH=/lib:/usr/lib

RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

WORKDIR /stream

ADD . /stream

CMD ["cat", "/etc/os-release"]


RUN poetry install && \
bundler install


EXPOSE 8000

CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]

docker 组成:
version: '3'

services:
redis:
image: redis
ports:
- 6379
web:
build: .
ports:
- 8000:8000
environment:
- REDISTOGO_URL=redis://redis:6379
depends_on:
- redis

最佳答案

将此添加到您的Dockerfile:

FROM python:2.7

ENV LIBRARY_PATH=/lib:/usr/lib

RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

WORKDIR /stream

ADD . /stream

ENV PATH="${PATH}:/root/.poetry/bin"

RUN poetry install && \
bundler install


EXPOSE 8000

CMD ["/root/.poetry/bin/poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]

另一方面,您需要在 network中设置一个 compose,以便能够使用服务名称在服务之间进行连接。

关于python -/bin/sh:1:诗歌:找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57495327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com