2

我正在尝试构建一个内部带有 mlflow 服务器的 docker 容器,其中包含用于依赖的诗歌 toml 文件。(两个 toml 完全相同,这只是一种尝试找出的方法)
树:

├── docker-entrypoint.sh
├── Dockerfile
├── 文件
│ └── pyproject.toml
├── git.sh
├── pyproject.toml
└── README.md

正如你所看到的,我的 toml 文件在 Dockerfile 旁边COPY pyproject.toml ./仍然不起作用

Dockerfile

FROM python:3.6.10-alpine3.10 as base
LABEL maintainer=""

ENV PYTHONFAULTHANDLER 1 
ENV    PYTHONHASHSEED random 
ENV    PYTHONUNBUFFERED 1

ENV MLFLOW_HOME ./ 
ENV SERVER_PORT 5000   
ENV    MLFLOW_VERSION 0.7.0 
ENV    SERVER_HOST 0.0.0.0  
ENV    FILE_STORE ${MLFLOW_HOME}/fileStore  
ENV    ARTIFACT_STORE ${MLFLOW_HOME}/artifactStore 
ENV PIP_DEFAULT_TIMEOUT 100
ENV    PIP_DISABLE_PIP_VERSION_CHECK on
ENV    PIP_NO_CACHE_DIR  off 
ENV    POETRY_VERSION  1.0.0 

WORKDIR ${MLFLOW_HOME}

FROM base as builder

RUN apk update  \
    && apk add --no-cache make gcc musl-dev python3-dev libffi-dev openssl-dev subversion
#download project file from github  repo 
RUN    svn export https://github.com/MChrys/QuickSign/trunk/  \
    && pip install poetry==${POETRY_VERSION} \
    && mkdir -p ${FILE_STORE}  \
    && mkdir -p ${ARTIFACT_STORE}\
    && python -m venv /venv

COPY  pyproject.toml ./
RUN poetry export -f requirements.txt | /venv/bin/pip install -r  --allow-root-install /dev/stdin 

COPY . .
RUN poetry build && /venv/bin/pip install dist/*.whl

FROM base as final

RUN apk add --no-cache libffi libpq
COPY --from=builder /venv /venv
COPY docker-entrypoint.sh ./

EXPOSE $SERVER_PORT

VOLUME ["${FILE_STORE}", "${ARTIFACT_STORE}"]

CMD ["./docker-entrypoint.sh"]

构建命令:

docker build - < Dockerfile

我收到此错误:

Step 21/32 : COPY  pyproject.toml ./
COPY failed: stat /var/lib/docker/tmp/docker-builder335195979/pyproject.toml: no such file or   directory

pyproject.toml

requires = ["poetry>=1.0.0", "mlflow>=0.7.0", "python>=3.6"]
build-backend = "poetry.masonry.api"

[tool.poetry]
name = "Sign"
description = ""
version = "1.0.0"
readme = "README.md"
authors = [
  ""
]

license = "MIT"


[tool.poetry.dependencies]
python = "3.6"
numpy = "1.14.3"
scipy = "*"
pandas = "0.22.0"
scikit-learn = "0.19.1"
cloudpickle = "*"
mlflow ="0.7.0"
tensorflow = "^2.0.0"


[tool.poetry.dev-dependencies]

pylint = "*"
docker-compose = "^1.25.0"
docker-image-size-limit = "^0.2.0"
tomlkit = "^0.5.8"

码头入口点.sh

#!/bin/sh

set -e

. /venv/bin/activate

mlflow server \
    --file-store $FILE_STORE \
    --default-artifact-root $ARTIFACT_STORE \
    --host $SERVER_HOST \
    --port $SERVER_PORT


如果我RUN pwd; ls在第一次COPY获得之前添加:

Step 20/31 : RUN pwd; ls
 ---> Running in e8ec36dd6ca8
/
artifactStore
bin
dev
etc
fileStore
home
lib
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
trunk
usr
var
venv
Removing intermediate container e8ec36dd6ca8
 ---> d7bba641bd7c
Step 21/31 : COPY  pyproject.toml ./
COPY failed: stat /var/lib/docker/tmp/docker-builder392824737/pyproject.toml: no such file or directory

4

1 回答 1

1

尝试 docker build -t test .

代替 docker build - < Dockerfile

于 2019-12-24T08:15:50.593 回答