Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"rpc error" with dockerfile:1.11 and 1.12 but not 1.10 #5579

Open
Roko131 opened this issue Dec 7, 2024 · 1 comment
Open

"rpc error" with dockerfile:1.11 and 1.12 but not 1.10 #5579

Roko131 opened this issue Dec 7, 2024 · 1 comment

Comments

@Roko131
Copy link

Roko131 commented Dec 7, 2024

Hi, This only happens when using # syntax=docker/dockerfile:1.11.0 with version 1.11 and 1.12, it works fine with versions 1.10 and lower

I'm using ubuntu, with docker-desktop Docker version 27.3.1, build ce12230
docker desktop version 4.36.0

Getting this error:
ERROR: failed to solve: failed to read downloaded context: failed to load cache key: rpc error: code = Unknown desc = no http response from session for lif43htupzm4oqx75d9a4tqrw

I'm running

/usr/bin/env git archive --format=tar HEAD | docker build -t ghcr.io/roko131/bich72-test:e00daad4153ed79f154dbbe74a6a4d62165312ce -t ghcr.io/roko131/bich72-test:latest --label service="my-app" --file Dockerfile -

Error when running docker build:

[+] Building 1.3s (5/5) FINISHED                                                                                                                                                             docker:desktop-linux
 => CACHED [internal] load remote build context                                                                                                                                                              0.0s
 => CACHED copy /context /                                                                                                                                                                                   0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1.11.0                                                                                                                               1.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.11.0@sha256:1f2be5a2aa052cbd9aedf893d17c63277c3d1c51b3fb0f3b029c6b34f658d057                                                                         0.0s
 => ERROR [internal] load remote build context                                                                                                                                                               0.0s
------
 > [internal] load remote build context:
------
Dockerfile:1
--------------------
   1 | >>> # syntax=docker/dockerfile:1.11.0
   2 |     # check=error=true
   3 |     
--------------------
ERROR: failed to solve: failed to read downloaded context: failed to load cache key: rpc error: code = Unknown desc = no http response from session for lif43htupzm4oqx75d9a4tqrw

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/lxfaxbbcej1xny5vs3gymtdpw

Here's the docker file:

# syntax=docker/dockerfile:1.11.0
# check=error=true

# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
# docker build -t my-app .
# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.3.1
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base

# Rails app lives here
WORKDIR /rails

# Install base packages
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Set production environment
ENV RAILS_ENV="production" \
    BUNDLE_DEPLOYMENT="1" \
    BUNDLE_PATH="/usr/local/bundle" \
    BUNDLE_WITHOUT="development"

# Throw-away build stage to reduce size of final image
FROM base AS build

# Install packages needed to build gems
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y build-essential git libpq-dev pkg-config && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
    rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
    bundle exec bootsnap precompile --gemfile

# Copy application code
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile




# Final stage for app image
FROM base

# Copy built artifacts: gems, application
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails

# Run and own only the runtime files as a non-root user for security
RUN groupadd --system --gid 1000 rails && \
    useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
    chown -R rails:rails db log storage tmp
USER 1000:1000

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
@tonistiigi
Copy link
Member

This issue has been fixed in buildkit v0.17.2+ and v0.18.0+ #5517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants