Logstash exec ruby script in docker

Hi, I'm trying to execute a ruby script which prints json data to stdout. I have tried different versions, and right now testing with the most basic script:

require 'json'

json_data = [
  { "uuid" => "noab14123dws11", "event_type" => "test", "created" => "2024-07-10T15:30:00Z" },
  { "uuid" => "3klhmls349s133", "event_type" => "test", "created" => "2024-07-10T14:35:00Z" }

json_string = json_data.to_json

puts json_string

In the logstash input i set:

exec {
    command => "unset JAVA_OPTS && /usr/share/logstash/bin/ruby  /usr/share/logstash/ruby_event_script.rb"
    interval => 60
    codec => "json"

I have tried in different ways with the provided jruby in docker. I had to unset the java opts variable because It was parsing a warning generated by ruby. Now when I run my pipeline I get in my logstash logs:
Bundler::GemNotFound: Could not find rubocop-1.63.5, rubocop-1.63.5, rubocop-1.63.5, ..... with a bunch of other packages. Code does not work, events are not added.

How can I get this setup to work?