-1

I am trying to install fluentd and having configuration below:-

  1. Docker Version=20.10.12
  2. Alpine Linux Version=3.17.3
  3. Ruby Version= 3.1.4p223

I am installing the fluentd with the script details below:-

apk add sudo
sudo apk update
sudo apk add ruby
ruby -v
sudo gem install fluentd

This is failing at "sudo gem install fluentd" step with the error below:-

While executing gem ... (Gem::FilePermissionError)
     You don't have write permissions for the /usr/lib/ruby/gems/3.1.0 directory.
    /usr/lib/ruby/3.1.0/rubygems/installer.rb:712:in `verify_gem_home'
    /usr/lib/ruby/3.1.0/rubygems/installer.rb:902:in `pre_install_checks'
    /usr/lib/ruby/3.1.0/rubygems/installer.rb:302:in `install'
    /usr/lib/ruby/3.1.0/rubygems/resolver/specification.rb:104:in `install'
    /usr/lib/ruby/3.1.0/rubygems/request_set.rb:194:in `block in install'
    /usr/lib/ruby/3.1.0/rubygems/request_set.rb:182:in `each'
    /usr/lib/ruby/3.1.0/rubygems/request_set.rb:182:in `install'
    /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:210:in `install_gem'
    /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:226:in `block in install_gems'
    /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:219:in `each'
    /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:219:in `install_gems'
    /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:167:in `execute'
    /usr/lib/ruby/3.1.0/rubygems/command.rb:323:in `invoke_with_build_args'
    /usr/lib/ruby/3.1.0/rubygems/command_manager.rb:185:in `process_args'
    /usr/lib/ruby/3.1.0/rubygems/command_manager.rb:149:in `run'
    /usr/lib/ruby/3.1.0/rubygems/gem_runner.rb:51:in `run'
    /usr/bin/gem:21:in `<main>'
 [0mThe command '/bin/sh -c /installFluent.sh' returned a non-zero code: 1

I dont have privilages to update the docker version or alpine version. Ruby version i can update if required. can someone please suggest any work around for this issue? PS:- I followed below link as well but didn't worked for me. You don't have write permissions for the /usr/lib/ruby/gems/2.7.0 directory (Alpine linux docker image)

DeadPool
  • 40
  • 8
  • What is the content of your Dockerfile? How do you build it? Run it? You might benefit from reading our [mre] help page. – β.εηοιτ.βε Aug 06 '23 at 06:45
  • ----DockerFile Start---- FROM clamav/clamav:1.1 COPY clamd.conf /etc/clamav ADD ./aboveScript.sh / RUN chmod +x /aboveScript.sh RUN /aboveScript.sh EXPOSE 3310/tcp ----DockerFile End---- Building docker file docker build --network=host -f Dockerfile -t ${tag} – DeadPool Aug 06 '23 at 07:26
  • This issue is very deep. I read somewhere that upgrading docker version to greater than 20.10.4 might help and we can install gems. my version is already above that. Then i read downgrading alipne version to 3.13 will help, that is something i cannot change. Then i read to install ruby using rbenv but this installation is also failing for given configuration. Something is really messed up with alpine linux, docker and ruby versions compatibilities. – DeadPool Aug 06 '23 at 07:35

0 Answers0