Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Docker build fails because unable to install `libc-bin`

$
0
0

Using kamal to deploy a rails app, but having trouble with docker and getting all installed. I in the past had it setup to use esbuild and yarn, but switched to bun later. Now, I need to install node for a tool on the ruby side, so trying to go back to esbuild/yarn/node for the setup.

But the Dockerfile below always fails with:

#16 CANCELED------> [linux/arm64 stage-2 1/4] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y curl libvips postgresql-client &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives:63.28 Processing triggers for libc-bin (2.31-13+deb11u5) ...63.33 qemu: uncaught target signal 11 (Segmentation fault) - core dumped63.33 Segmentation fault63.34 qemu: uncaught target signal 11 (Segmentation fault) - core dumped63.34 Segmentation fault63.34 dpkg: error processing package libc-bin (--configure):63.34  installed libc-bin package post-installation script subprocess returned error exit status 13963.44 Errors were encountered while processing:63.44  libc-bin63.54 E: Sub-process /usr/bin/dpkg returned an error code (1)------Dockerfile:64--------------------  63 |     # Install packages needed for deployment  64 | >>> RUN apt-get update -qq && \  65 | >>>     apt-get install --no-install-recommends -y curl libvips postgresql-client && \  66 | >>>     rm -rf /var/lib/apt/lists /var/cache/apt/archives  67 |--------------------ERROR: failed to solve: process "/bin/sh -c apt-get update -qq &&     apt-get install --no-install-recommends -y curl libvips postgresql-client &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives" did not complete successfully: exit code: 100

How can I get this working again? The basic requirement is to get the base Ruby 3.2.1 image up and running with Node, but I can't seem to get there. I've tried installing libc-bin directly, but it made no difference.

Dockerfile:

# syntax = docker/dockerfile:1# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and GemfileARG RUBY_VERSION=3.2.1FROM registry.docker.com/library/ruby:$RUBY_VERSION as base# Rails app lives hereWORKDIR /rails# Set production environmentENV RAILS_ENV="production" \    BUNDLE_DEPLOYMENT="1" \    BUNDLE_PATH="/usr/local/bundle" \    BUNDLE_WITHOUT="development"# Throw-away build stage to reduce size of final imageFROM base as build# Install packages needed to build gems and node modulesRUN apt-get update -qq && \    # apt-get install --no-install-recommends -y build-essential curl git node-gyp pkg-config python-is-python3 libpq-dev libvips unzip    apt-get install --no-install-recommends -y build-essential curl git node-gyp pkg-config python-is-python3 libpq-dev unzip# RUN apt-get update -qq && \#     apt-get install --no-install-recommends -y build-essential curl git node-gyp pkg-config python-is-python3# Install JavaScript dependenciesARG NODE_VERSION=21.5.0ARG YARN_VERSION=1.22.19ENV PATH=/usr/local/node/bin:$PATHRUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \    /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \    npm install -g yarn@$YARN_VERSION && \    rm -rf /tmp/node-build-master# Install application gemsCOPY Gemfile Gemfile.lock ./RUN bundle install && \    rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \    bundle exec bootsnap precompile --gemfile# Install node modulesCOPY package.json yarn.lock ./RUN yarn install --frozen-lockfile# Copy application codeCOPY . .# Precompile bootsnap code for faster boot timesRUN bundle exec bootsnap precompile app/ lib/# Precompiling assets for production without requiring secret RAILS_MASTER_KEYRUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile# Final stage for app imageFROM base# Install packages needed for deploymentRUN apt-get update -qq && \    apt-get install --no-install-recommends -y curl libvips postgresql-client && \    rm -rf /var/lib/apt/lists /var/cache/apt/archives# Copy built artifacts: gems, applicationCOPY --from=build /usr/local/bundle /usr/local/bundleCOPY --from=build /rails /rails# Run and own only the runtime files as a non-root user for securityRUN useradd rails --create-home --shell /bin/bash && \    chown -R rails:rails db log storage tmpUSER rails:rails# Entrypoint prepares the database.ENTRYPOINT ["/rails/bin/docker-entrypoint"]# Start the server by default, this can be overwritten at runtimeEXPOSE 3000CMD ["./bin/rails", "server"]

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>