pytorch Docker构建在最后一步失败,但在交互式环境中运行

gmxoilav  于 2022-12-13  发布在  Docker
关注(0)|答案(1)|浏览(151)

When I build the following Docker, the last step raises an error, but when I run the latest step image and run the same command it succeeds. I run in a Centos 7 server. There is a preinstalled podman service there. The issue might be related to this one: https://github.com/containers/buildah/issues/1544
Dockerfile:

FROM python:3.10.6

RUN apt update
RUN apt -y upgrade
RUN apt search golang-go
RUN apt install -y golang-go
# expose streamlit port
EXPOSE 8501

# working dir is /app
WORKDIR /app
ENV PYTHONPATH=/app

# Install virtual environment
RUN pip install poetry
COPY ./pyproject.toml /app
RUN poetry config virtualenvs.create false
RUN poetry install --no-root

pyproject

[tool.poetry]
version = "0.1.0"
description = ""
readme = "README.md"

[tool.pytest.ini_options]
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"

[tool.poetry.dependencies]
torch = [{markers = "sys_platform == 'macos'", url = "https://download.pytorch.org/whl/cpu/torch-1.13.0-cp310-none-macosx_11_0_arm64.whl"},
{markers = "sys_platform == 'linux' and platform_machine == 'arm64'", url="https://download.pytorch.org/whl/torch-1.13.0-cp310-cp310-manylinux2014_aarch64.whl"},
{markers = "sys_platform == 'linux' and platform_machine == 'x86_64'", url="https://download.pytorch.org/whl/cpu/torch-1.13.0%2Bcpu-cp310-cp310-linux_x86_64.whl"}]

python = "^3.10"
pytest = "^7.2.0"
toml = "^0.10.2"
scikit-learn = "^1.1.3"
scikit-optimize = "^0.9.0"
ax-platform = "^0.2.8"
setuptools = "^65.5.1"
fire = "^0.4.0"
jupyter = "^1.0.0"
streamlit-ace = "^0.1.1"
humanfriendly = "^10.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

When building I get:
Writing lock file
Package operations: 126 installs, 1 update, 0 removals
error building at step {Env:[PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LANG=C.UTF-8 GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D PYTHON_VERSION=3.10.6 PYTHON_PIP_VERSION=22.2.1 PYTHON_SETUPTOOLS_VERSION=63.2.0 PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/5eaac1050023df1f5c98b173b248c260023f2278/public/get-pip.py PYTHON_GET_PIP_SHA256=5aefe6ade911d997af080b315ebcb7f882212d070465df544e1175ac2be519b4 PYTHONPATH=/app] Command:run Args:[poetry install --no-root] Flags:[] Attrs:map[] Message:RUN poetry install --no-root Original:RUN poetry install --no-root}: error while running runtime: exit status 1
In interactive shell of the last successful step I get no error. Internally it seems like the install is using the correct torch version • Installing torch (1.13.0+cpu https://download.pytorch.org/whl/cpu/torch-1.13.0%2Bcpu-cp310-cp310-linux_x86_64.whl)

lo8azlld

lo8azlld1#

只是改变了

RUN poetry install --no-root

RUN poetry install --no-root --no-interaction

相关问题