0

问题陈述

我有以下内容Dockerfile

ARG BASE_IMAGE=python:3.9-slim

FROM $BASE_IMAGE as base

RUN apt update && \
    apt install --yes --no-install-recommends \
        build-essential \
        libsasl2-dev && \
    apt clean

RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

RUN pip install --upgrade --no-cache-dir pip && \
    pip install --no-cache-dir dbt-spark[PyHive]==0.20.1


FROM $BASE_IMAGE as runtime

RUN apt update && \
    apt install --yes --no-install-recommends \
        ca-certificates \
        git \
        tini && \
    apt clean

ENV PATH="/opt/venv/bin:$PATH"
COPY --from=base /opt/venv /opt/venv

RUN useradd dbt --user-group --home-dir /home/dbt
USER dbt

WORKDIR /home/dbt
COPY --chown=dbt:dbt . .

ENV DBT_PROFILES_DIR=/home/dbt
RUN dbt deps

ENTRYPOINT [ "tini", "--", "dbt" ]

当我使用 BuildKit ( DOCKER_BUILDKIT=1) 时,图像成功构建。

当我不使用 BuildKit 时,我收到以下错误:

[Errno 13] Permission denied: 'logs'
The command '/bin/sh -c dbt deps' returned a non-zero code: 2

我试图理解为什么。

额外细节

我曾经strace跟踪导致错误的系统调用,结果如下:

stat("logs", 0x7ffcdbcd46b0)            = -1 ENOENT (No such file or directory)
mkdir("logs", 0777)                     = -1 EACCES (Permission denied)
4

0 回答 0