compose: Docker in Docker cannot build Ruby on alpine 3.14+

Description

Using compose, build the following image in a Docker in Docker ecosystem (It is only possible with alpine 3.13 and below)

FROM ruby:3.0.3-alpine3.13

ENV BUNDLER_VERSION=2.3.6 \
    BUNDLE_PATH=/app/vendor/bundle

RUN apk add --no-cache --update build-base bash jq curl libffi-dev

RUN mkdir -p /app

COPY Gemfile* /app/

WORKDIR /app

RUN gem install bundler -v $BUNDLER_VERSION && \
    bundle install && \
    gem cleanup

RUN addgroup --gid 1000 ruby && \
    adduser --home /home/ruby --uid 1000 --ingroup ruby --disabled-password ruby

COPY . /app

RUN chown -R 1000:1000 /app

USER 1000

Describe the results you received: As soon as you use alpine 3.14 and above, you get a permission error.

ERROR:  While executing gem ... (Gem::FilePermissionError)

    You don't have write permissions for the /usr/local/bundle directory.

Describe the results you expected: It works.

Additional information you deem important (e.g. issue happens only occasionally): This is not an issue up to December 2021 - As alpine 3.13 exists for all modern rubies

This is an issue for ruby 3.1.x+ as there is no alpine 3.13 equivalent for this (Minimum alpine is 3.14)

Output of docker compose version:

docker-compose version
— Shell Script
<1s
+ docker-compose version

docker-compose version 1.29.2, build 5becea4c

docker-py version: 5.0.0

CPython version: 3.7.10

OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Output of docker info:

ADDING SHORTLY from new ci run

Additional environment details: N/A

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16

Most upvoted comments

ok. Then, please prepare a minimal Dockerfile to demonstrate this bug, then report an issue on moby/moby as this definitively is the wrong repo for this