COPY文件-Dockerfile旁边-不工作并阻止Docker构建

时间:2019-12-24 05:54:19

标签: docker dockerfile mlflow python-poetry

我正在尝试构建一个带有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"]

build命令:

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"

docker-entrypoint.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

1 个答案:

答案 0 :(得分:1)

尝试 julia> df = join(DataFrame(ta1), DataFrame(ta2), DataFrame(ta3), on = :timestamp, kind = :outer, makeunique=true) 4×4 DataFrame │ Row │ timestamp │ A │ A_1 │ A_2 │ │ │ Date │ Int64⍰ │ Int64⍰ │ Int64⍰ │ ├─────┼────────────┼─────────┼─────────┼─────────┤ │ 1 │ 2015-10-01 │ 15 │ missing │ missing │ │ 2 │ 2015-11-01 │ 16 │ 11 │ missing │ │ 3 │ 2015-12-01 │ missing │ 3 │ 1 │ │ 4 │ 2016-01-01 │ missing │ missing │ 5 │ julia> df = coalesce.(df, 0) 4×4 DataFrame │ Row │ timestamp │ A │ A_1 │ A_2 │ │ │ Date │ Int64 │ Int64 │ Int64 │ ├─────┼────────────┼───────┼───────┼───────┤ │ 1 │ 2015-10-01 │ 15 │ 0 │ 0 │ │ 2 │ 2015-11-01 │ 16 │ 11 │ 0 │ │ 3 │ 2015-12-01 │ 0 │ 3 │ 1 │ │ 4 │ 2016-01-01 │ 0 │ 0 │ 5 │ julia> df.A += (df.A_1 .+ df.A_2) 4-element Array{Int64,1}: 15 27 4 5 julia> TimeArray(df.timestamp, df.A) 4×1 TimeArray{Int64,1,Date,Array{Int64,1}} 2015-10-01 to 2016-01-01 │ │ A │ ├────────────┼───────┤ │ 2015-10-01 │ 15 │ │ 2015-11-01 │ 27 │ │ 2015-12-01 │ 4 │ │ 2016-01-01 │ 5 │

而不是 docker build -t test .