简体   繁体   English

Docker 构建访问被拒绝

[英]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 logindocker 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 .在下面的代码中,我假设您希望basepython: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.

相关问题 构建django docker容器时如何解决(1045,“用户'用户'@'IP或主机'的访问被拒绝(使用密码:YES)”)? - how to resolve (1045, "Access denied for user 'User'@'IP or host' (using password: YES)") when build django docker container? Sublime Python 构建不工作 [WinError 5] 访问被拒绝 - Sublime Python Build Not Working [WinError 5] Access is denied 用户在python docker容器中连接远程MySQL数据库的访问被拒绝 - Access denied for the user to connect remote MySQLdatabase in python docker container 错误:postgress 的拉取访问被拒绝,存储库不存在或可能需要“docker 登录”:拒绝:请求的资源访问被拒绝 - ERROR: pull access denied for postgress, repository does not exist or may require 'docker login': denied: requested access to the resource is denied Docker Selenium Chromedriver:不幸的是,对此页面的自动访问被拒绝 - Docker Selenium Chromedriver: Unfortunately, automated access to this page was denied docker-compose build -> 许多“PermissionError:[Errno 13] Permission denied”错误 - docker-compose build -> many "PermissionError: [Errno 13] Permission denied" error's Docker 数据库访问被拒绝 - Docker Database acces denied 在docker-compose烧瓶中构建项目期间访问ssh密钥 - Access ssh keys during docker-compose build in flask project 无法连接到Docker中的MySql。 拒绝访问拒绝错误。 烧瓶的SQLAlchemy - Cannot connect to MySql in Docker. Access Denied Error thrown. Flask-SqlAlchemy pycharm_helpers的拉式访问被拒绝,存储库不存在或可能需要“ docker登录” - Pull access denied for pycharm_helpers, repository does not exist or may require 'docker login'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM