I've been trying to get past this error in VS code when building in docker on an M1 Macbook. I attached my dockerfile and error message. Not sure if the M1 is causing some issues or not. 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. 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.
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
CodePudding user response:
Docker doesn't know what base
is. You need to define it. In the code below, I assume you want base
to be python:3.9-slim
. The subsequent FROM
steps will use the image made by the first FROM
section.
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
# ...