4

我有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

似乎没有效果。当我进入容器时,路径似乎没有改变。

4

1 回答 1

2

我提供的最佳解决方案是手动设置环境,因为二进制文件本身安装良好

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ENV PATH = "${PATH}:/root/.poetry/bin"
于 2020-01-24T13:09:16.013 回答