![](/img/trans.png)
[英]Poetry install fails during docker build with CalledProcessError and EnvCommandError
[英]Poetry fails to install in Docker
我有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
好像沒什么效果。 當我進入容器時,路徑似乎沒有改變。
我提供的最佳解決方案是手動設置 env,因為二進制文件本身安裝得很好
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ENV PATH = "${PATH}:/root/.poetry/bin"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.