question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails to install Poetry when running docker-compose

See original GitHub issue
Step 6/8 : RUN poetry install &&     bundler install
 ---> Running in da6a35f96e3d
/bin/sh: poetry: not found
ERROR: Service 'web' failed to build: The command '/bin/sh -c poetry install &&     bundler install' returned a non-zero code: 127

This is the error I get when I run docker-compose up -d

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:5

github_iconTop GitHub Comments

2reactions
mohsen74commented, Aug 15, 2019

I solved the problem with changing DockerFile to:

FROM python:2.7

ENV LIBRARY_PATH=/lib:/usr/lib

WORKDIR /stream

ADD . /stream

RUN apt update
RUN apt install -y python-pip
RUN pip install poetry==0.8.1
RUN  poetry install

EXPOSE 8000
CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]
1reaction
chustevencommented, Jan 13, 2022

In case it helps anyone years later 😅 I kept the same base image but amended just a couple of lines below. Looks like py2-anyjson support was dropped from alpine here and then the poetry stuff I guess was ripped off from above 😄

RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \
-    git zlib-dev jpeg-dev gcc musl-dev postgresql-dev py2-anyjson ruby-bundler py2-pip libjpeg curl && \
+    git py-pip zlib-dev jpeg-dev gcc musl-dev postgresql-dev py-anyjson ruby-bundler py2-pip libjpeg curl && \
     curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python

 WORKDIR /stream

 ADD . /stream

+RUN pip install poetry==0.8.1
 RUN poetry install && \
     bundler install

 EXPOSE 8000

-CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]
+CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry still fails to install in Docker · Issue #1227 - GitHub
Adding --no-root to poetry install seems to fix this without needing to copy the source. This allows Docker builds to better cache a...
Read more >
Installing Poetry fails on Docker - python - Stack Overflow
I use Poetry, so I have to install Poetry in the container. Below is my Dockerfile . FROM python:3.9.7-alpine WORKDIR /usr/src/app ENV ...
Read more >
Support poetry in docker-compose python interpreter - YouTrack
Have access to all installed by poetry for the project. What happens instead? Only the packages necessary to run poetry in the global...
Read more >
Having trouble with Python poetry in docker - Reddit
My project doesn't have an /app/dist path. As far as I'm aware, that gets created during the builder phase with poetry install and...
Read more >
Introduction | Documentation | Poetry - Python dependency ...
If you decide Poetry isn't your thing, you can completely remove it from your system by running the installer again with the --uninstall...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found