[英]Docker Build access denied
I've been trying to get past this error in VS code when building in docker on an M1 Macbook.在 M1 Macbook 上构建 docker 时,我一直试图克服 VS 代码中的这个错误。 I attached my dockerfile and error message.我附上了我的 dockerfile 和错误消息。 Not sure if the M1 is causing some issues or not.不确定 M1 是否引起了一些问题。 I was able to change the docker engine settings and change it the features buildkit to "false" since it was true before and that helped me get moving along.我能够更改 docker 引擎设置并将其功能 buildkit 更改为“false”,因为它之前是真的,这帮助我继续前进。 I logged in and out of using docker login
& docker logout
and when I do the build again, I still get the same error message that the pull access denied.我使用docker login
和docker logout
登录和注销,当我再次进行构建时,我仍然收到相同的错误消息,即拒绝访问。
dockerfile:码头文件:
FROM --platform=linux/amd64 python:3.9-slim
# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
#----------------------------------------------------------------------------
FROM base AS python-deps
# Install pipenv and compilation dependencies
RUN pip install pipenv
RUN apt-get update && apt-get install -y --no-install-recommends gcc lsb-release
# Install python dependencies in /.venv
COPY Pipfile .
COPY Pipfile.lock .
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
# Record information about Linux distribution
RUN lsb_release -ds > /.lsb-release
#----------------------------------------------------------------------------
FROM base AS runtime
ARG GIT_COMMIT_SHA GIT_COMMIT_SHA_SHORT GIT_COMMIT_MSG GIT_COMMIT_AUTHOR_EMAIL GIT_COMMIT_AUTHOR_NAME GIT_COMMIT_AUTHOR_DATE_ISO8601 GIT_COMMIT_AUTHOR_DATE_UNIX GIT_URL GIT_WEB_URL
RUN echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}"
RUN echo "GIT_COMMIT_SHA_SHORT=${GIT_COMMIT_SHA_SHORT}"
RUN echo "GIT_COMMIT_MSG=${GIT_COMMIT_MSG}"
RUN echo "GIT_COMMIT_AUTHOR_EMAIL=${GIT_COMMIT_AUTHOR_EMAIL}"
RUN echo "GIT_COMMIT_AUTHOR_NAME=${GIT_COMMIT_AUTHOR_NAME}"
RUN echo "GIT_COMMIT_AUTHOR_DATE_ISO8601=${GIT_COMMIT_AUTHOR_DATE_ISO8601}"
RUN echo "GIT_COMMIT_AUTHOR_DATE_UNIX=${GIT_COMMIT_AUTHOR_DATE_UNIX}"
RUN echo "GIT_URL=${GIT_URL}"
RUN echo "GIT_WEB_URL=${GIT_WEB_URL}"
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA} \
GIT_COMMIT_SHA_SHORT=${GIT_COMMIT_SHA_SHORT} \
GIT_COMMIT_MSG=${GIT_COMMIT_MSG} \
GIT_COMMIT_AUTHOR_EMAIL=${GIT_COMMIT_AUTHOR_EMAIL} \
GIT_COMMIT_AUTHOR_NAME=${GIT_COMMIT_AUTHOR_NAME} \
GIT_COMMIT_AUTHOR_DATE_ISO8601=${GIT_COMMIT_AUTHOR_DATE_ISO8601} \
GIT_URL=${GIT_URL} \
GIT_WEB_URL=${GIT_WEB_URL} \
GIT_COMMIT_AUTHOR_DATE_UNIX=${GIT_COMMIT_AUTHOR_DATE_UNIX}
# Copy virtual env from python-deps stage
COPY --from=python-deps /.venv /.venv
COPY --from=python-deps /.lsb-release /.lsb-release
ENV PATH="/.venv/bin:$PATH"
# Create and switch to a new user
RUN useradd --create-home appuser
WORKDIR /home/appuser
USER appuser
# Install application into container
COPY . .
RUN streamlit --version | cut -d' ' -f3 > streamlit-version
now here is my error code:现在这是我的错误代码:
Sending build context to Docker daemon 34.45MB
Step 1/33 : FROM --platform=linux/amd64 python:3.9-slim
---> ae64b82339a8
Step 2/33 : ENV LANG C.UTF-8
---> Using cache
---> 5f0920efde24
Step 3/33 : ENV LC_ALL C.UTF-8
---> Using cache
---> 2eb01b896c74
Step 4/33 : ENV PYTHONDONTWRITEBYTECODE 1
---> Using cache
---> ce8e702d0b31
Step 5/33 : ENV PYTHONFAULTHANDLER 1
---> Using cache
---> 167c8aaab6ce
Step 6/33 : FROM base AS python-deps
pull access denied for base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Docker doesn't know what base
is. Docker 不知道base
是什么。 You need to define it.你需要定义它。 In the code below, I assume you want base
to be python:3.9-slim
.在下面的代码中,我假设您希望base
为python:3.9-slim
。 The subsequent FROM
steps will use the image made by the first FROM
section.随后的FROM
步骤将使用第一个FROM
部分生成的图像。
FROM python:3.9-slim AS base
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
FROM base AS python-deps
RUN pip install pipenv
# ...
FROM base AS runtime
# ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.