fluent / fluentd-docker-image

Docker image for Fluentd
https://hub.docker.com/r/fluent/fluentd/
Apache License 2.0
464 stars 351 forks source link

Cannot build multi-platform image #373

Closed igoberman closed 3 months ago

igoberman commented 10 months ago

Hi I followed your instructions to build a custom docker image based on https://github.com/fluent/fluentd-docker-image

My docker file is below `FROM fluent/fluentd:v1.16.2-1.1 MAINTAINER YOUR_NAME ...@...

USER root

RUN apk add --no-cache --update --virtual .build-deps \ sudo build-base ruby-dev \ && sudo gem install fluent-plugin-cloudwatch-logs \ && sudo gem sources --clear-all \ && apk del .build-deps \ && rm -rf /home/fluent/.gem/ruby/2.5.0/cache/*.gem

COPY fluent.conf /fluentd/etc/ COPY entrypoint.sh /bin/

USER fluent`

I then run buildx command below to create multi platform image for amd64 and arm64 linux.

docker buildx build --push --builder=container --platform=linux/amd64,linux/arm64 -t barchart/barchart-fluentd:3.0 ./

However, I am getting this error. I am doing the build on Mac. Do you know what I am doing wrong? Thanks

`#0 12.88 OK: 270 MiB in 54 packages

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

0 15.13 You don't have write permissions for the /usr/lib/ruby/gems/3.1.0 directory.

0 15.13 /usr/lib/ruby/3.1.0/rubygems/installer.rb:712:in `verify_gem_home'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/installer.rb:902:in `pre_install_checks'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/installer.rb:302:in `install'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/resolver/specification.rb:104:in `install'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/request_set.rb:194:in `block in install'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/request_set.rb:182:in `each'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/request_set.rb:182:in `install'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:210:in `install_gem'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:226:in `block in install_gems'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:219:in `each'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:219:in `install_gems'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/commands/install_command.rb:167:in `execute'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/command.rb:323:in `invoke_with_build_args'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/command_manager.rb:185:in `process_args'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/command_manager.rb:149:in `run'

0 15.13 /usr/lib/ruby/3.1.0/rubygems/gem_runner.rb:51:in `run'

0 15.13 /usr/bin/gem:21:in `
'


ERROR: failed to solve: executor failed running [/bin/sh -c apk add --no-cache --update --virtual .build-deps sudo build-base ruby-dev && sudo gem install fluent-plugin-cloudwatch-logs && sudo gem sources --clear-all && apk del .build-deps && rm -rf /home/fluent/.gem/ruby/2.5.0/cache/*.gem]: buildkit-runc did not terminate successfully `

kenhys commented 3 months ago

I am doing the build on Mac.

We don't know the proven way to build it on Mac yet and will not support it. If you find it, feedback is welcome! (As basically build on Linux in most of cases, so I'll close it)