CI will end with an error from the day when Docker Image is cleared
bundle install --clean now fails.
Bundle complete! 62 Gemfile dependencies, 187 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. Cleaning all the gems on your system is dangerous! If you're sure you want to remove every system gem not in this bundle, run `bundle clean --force`. Service'xxxx' failed to build: The command'/bin/sh -c bundle install --clean' returned a non-zero code: 15
It is displayed once as
Bundle complete!, but then
Cleaning all the gems on your system is dangerous! is returned as
code: 15 and the processing ends in error.
Dockerfile of the container in question
FROM ruby:2.6.5 ENV RUBYOPT -EUTF-8 ENV LANG C.UTF-8 RUN gem install rails -v 6.0.2 # Abbreviated below
BUNDLE_PATH was not set automatically due to the following changes in Docker Image of Ruby. Stop setting `BUNDLE_PATH` by deivid-rodriguez · Pull Request #306 · docker-library/ruby
BUNDLE_PATH was not specified on the Dockerfile, the setting in Image was deleted and the specification of
BUNDLE_PATH became empty, and the target became global.
Therefore, it is considered that the following message was displayed.
Cleaning all the gems on your system is dangerous! If you're sure you want to remove every system gem not in this bundle, run `bundle clean --force`.
There was no problem because I was using an old image in the cache for a while, but I had a problem by clearing the cache and re-acquiring the Image.
It was solved by adding
ENV BUNDLE_PATH=$GEM_HOME to the Dockerfile (the part deleted in the above PR is described in its own Dockerfile).
(At first I added it to the
environment of the docker-compose file, but the error was not resolved. I was in a hurry so I have not been able to verify it in detail…)