You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker Compose构建失败求助:升级Desktop后无法拉取Ruby镜像

Docker Desktop升级后构建特定Ruby镜像失败(Mac M1)

升级Docker Desktop至最新版本后,其他镜像可正常使用,但构建目标Ruby镜像时出现异常,报错信息如下:

[+] Building 2.4s (2/3)
[+] Building 2.5s (3/3) FINISHED
=> [internal] load build definition from Dockerfile                                                                                                                             0.0s
=> => transferring dockerfile: 3.39kB                                                                                                                                           0.0s
=> [internal] load .dockerignore                                                                                                                                                0.0s
=> => transferring context: 264B                                                                                                                                                0.0s
=> ERROR [internal] load metadata for docker.io/library/ruby:3.1.0-preview1-buster                                                                                              2.4s

> [internal] load metadata for docker.io/library/ruby:3.1.0-preview1-buster:

---

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ``

设备环境:Mac M1,运行最新版Docker Desktop。

对应的Dockerfile内容:

# Good References
# https://github.com/dirkdk/docker-rails-demo
# https://www.digitalocean.com/community/tutorials/containerizing-a-ruby-on-rails-application-for-development-with-docker-compose

FROM ruby:3.1.0-preview1-buster

RUN apt-get update && apt-get -y install curl gnupg
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(grep -oP 'VERSION_CODENAME=\K\w+' /etc/os-release)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN curl -q https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt-get -y update
RUN apt-get install --fix-missing --no-install-recommends -qq -y \
        build-essential \
        vim \
        wget gnupg \
        git-all \
        curl \
        ssh \
        wkhtmltopdf \
        postgresql-client-11 libpq5 libpq-dev -y
RUN wget -qO- https://deb.nodesource.com/setup_14.x  | bash -
RUN apt-get install -y nodejs
RUN wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
RUN apt-get update
RUN apt-get install yarn
RUN apt-get install less
RUN apt-get install nano
RUN apt-get install libmagickwand-dev
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ARG INSTALL_PATH=/firebolt
ENV INSTALL_PATH $INSTALL_PATH
WORKDIR $INSTALL_PATH

# Copy gemfile & package.json, do NOT install unless this is a production build
# For local development these are maintained in cached volumes
COPY Gemfile Gemfile.lock /firebolt/
COPY package.json yarn.lock ./

# Only need to pass in the rails master key if this is a production build
ARG production
COPY scripts/ /firebolt/scripts
RUN scripts/potential_package_install.sh $production

# Copy the entire directory
COPY . /firebolt

# For convenience, lets copy over a .bashrc file
COPY .bashrc /root/.bashrc

# Precompile assets if this is a production build and not in render (otherwise we use webpacker in development)
# Render (our cloud service provider) was having problems with precompiling assets because we would require more than
# 4GB of RAM and that's all they offered. There were a few options
# 1) They could increase their RAM limit (no plans to do so)
# 2) They could offer deployment straight from a private docker image (on the roadmap but currently requires build)
# 3) [Selected] We could commit the assets to our repo then skip the asset compilation step on render. We only do it in
#    the github action which then submits another commit
ARG precompile_assets
RUN echo "Production Build: $precompile_assets"
RUN scripts/potential_asset_precompile.sh $precompile_assets

# Designate the entrypoint which will run migrations and start a rails server (this should only run for production)
# Overridden in docker-compose for development
# TODO: We shouldn't need to override this everywhere, we should just not be executing if it isn't production
RUN chmod +x scripts/migrate_and_start.sh

# Change ImageMagick PDF policy.xml
# RUN sed -i_bak 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml

# Install jpg/pdf extensions
RUN apt-get -y update
RUN apt-get -y install poppler-utils
RUN apt-get -y install img2pdf

ENTRYPOINT [ "scripts/migrate_and_start.sh" ]

已尝试的解决操作:

  • 清理Docker缓存
  • 删除相关镜像
  • 重装Docker Desktop
  • 更换Docker版本及Ruby镜像版本

以上操作均未解决问题。

内容的提问来源于stack exchange,提问作者LEONARDO FERNANDES ZAPPANI

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 00:15:02