简体   繁体   中英

Poetry fails to install in Docker

I've got alpine:edge as base image and want to use poetry in it. I'm trying to install it like that:

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
RUN source $HOME/.poetry/env

Script works without errors, but when I try to actually use it, bash says it is not installed:

Step 16/18 : RUN poetry install --no-dev
 ---> Running in 38ce454369cb
/bin/sh: poetry: not found

What can cause this issue?

UPD: Looks like there is something wrong with env file:

~/.poetry # source env
/bin/sh: /usr/bin/env: line 1: ELF: not found
/bin/sh: /usr/bin/env: line 2: �: not found
/bin/sh: /usr/bin/env: line 3: �: not found
/bin/sh: /usr/bin/env: �
                        : not found
/bin/sh: /usr/bin/env: ��: not found
/bin/sh: /usr/bin/env: �e�mgUa: not found
/bin/sh: /usr/bin/env: M�Z��!9!di9WۓŹ�@9�����o�!���7e�
                                                      �ݣk��: not found
/bin/sh: /usr/bin/env: �
                        �B��
                            ��
                              ��
                                �Q�tdR�td: not found
/bin/sh: /usr/bin/env: �n�镳�: not found
/bin/sh: /usr/bin/env: �
                        : not found
/bin/sh: /usr/bin/env: ���
                          �
                           �
L�@�DIklqrsvwxz: not found  �9�9/lib/ld-musl-x86_64.so.1k�!�R
/bin/sh: /usr/bin/env: �������2����
                                   ��
                                     p�
                                      n��: not found
/bin/sh: /usr/bin/env: syntax error: unterminated quoted string
~/.poetry # source env
/bin/sh: /usr/bin/env: line 1: ELF: not found
/bin/sh: /usr/bin/env: line 2: �: not found
/bin/sh: /usr/bin/env: line 3: �: not found
/bin/sh: /usr/bin/env: �
                        : not found
/bin/sh: /usr/bin/env: �n�镳�: not found
/bin/sh: /usr/bin/env: �
                        �B��
                            ��
                              ��
                                �Q�tdR�td: not found
/bin/sh: /usr/bin/env: �e�mgUa: not found
/bin/sh: /usr/bin/env: M�Z��!9!di9WۓŹ�@9�����o�!���7e�
                                                      �ݣk��: not found
/bin/sh: /usr/bin/env: �
                        : not found
/bin/sh: /usr/bin/env: ���
                          �
                           �
L�@�DIklqrsvwxz: not found  �9�9/lib/ld-musl-x86_64.so.1k�!�R
/bin/sh: /usr/bin/env: ��: not found
/bin/sh: /usr/bin/env: �������2����
                                   ��
                                     p�
                                      n��: not found
/bin/sh: /usr/bin/env: syntax error: unterminated quoted string

I've tried manually adding the binary to the path, but running

RUN export PATH=$PATH:/root/.poetry/bin

Seems to have no effect. When I shell into the container, path appears not to be changed.

The best solution I've came with is manually setting the env, since the binary itself installs fine

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ENV PATH = "${PATH}:/root/.poetry/bin"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM