诗歌无法在Docker中安装

时间:2020-01-24 11:41:32

标签: docker python-poetry

我有 alpine:edge 作为基本图片,并且想在其中使用诗歌。我正在尝试像这样安装它:

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

脚本可以正常工作,但是当我尝试实际使用它时,bash表示未安装该脚本:

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

什么会导致此问题?

UPD:env文件似乎有问题:

~/.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

我尝试将二进制文件手动添加到路径,但是正在运行

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

似乎无效。当我将它装入容器时,路径似乎没有改变。

1 个答案:

答案 0 :(得分:0)

我自带的最好的解决方案是手动设置环境,因为二进制文件本身可以很好地安装

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