moby: Docker in Docker cannot install bundler (ruby gem), 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

RUN gem install bundler -v $BUNDLER_VERSION

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

This is related to this docker-library/ruby#351 (comment) Alpine need 3.14 at least docker 20.10 on the host. Hi @HugoPoi,

I am running Docker 20.10.21 but still having the issue though.