Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /usr/lib/ruby/gems/3.1.0 directory #337

Closed
toyaser opened this issue Jul 18, 2022 · 2 comments

Comments

@toyaser
Copy link

toyaser commented Jul 18, 2022

I am building my own custom docker image and below is my Dockerfile

FROM fluent/fluentd:v1.15-1

# Use root account to use apk
USER root

RUN apk add --no-cache --update --virtual .build-deps \
        sudo build-base ruby-dev \
 && sudo gem install fluent-plugin-elasticsearch \
 && sudo gem sources --clear-all \
 && apk del .build-deps \
 && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
.
.
.

When running the Dockerfile, I get the following:

(11/26) Installing mpc1 (1.2.1-r0)
(12/26) Installing gcc (11.2.1_git20220219-r2)

(13/26) Installing musl-dev (1.2.3-r0)
(14/26) Installing libc-dev (0.7.2-r3)
(15/26) Installing g++ (11.2.1_git20220219-r2)

(16/26) Installing make (4.3-r0)
(17/26) Installing fortify-headers (1.1-r1)
(18/26) Installing patch (2.7.6-r7)
(19/26) Installing build-base (0.5-r3)
(20/26) Installing ruby-rdoc (3.1.2-r0)
(21/26) Installing libgmpxx (6.2.1-r2)
(22/26) Installing pkgconf (1.8.0-r0)
(23/26) Installing gmp-dev (6.2.1-r2)
(24/26) Installing libucontext-dev (1.2-r0)
(25/26) Installing ruby-dev (3.1.2-r0)
(26/26) Installing .build-deps (20220718.183134)
Executing busybox-1.35.0-r13.trigger
OK: 212 MiB in 52 packages

�[91mERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/lib/ruby/gems/3.1.0 directory.
�[0mThe command '/bin/sh -c apk add --no-cache --update --virtual .build-deps         sudo build-base ruby-dev  && sudo gem install fluent-plugin-elasticsearch  && sudo gem sources --clear-all  && apk del .build-deps  && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem' returned a non-zero code: 1

This only happens with version 1.15-1 of fluentd, same Dockerfile works perfectly fine for v1.14.6-1.1

@ashie
Copy link
Member

ashie commented Jul 20, 2022

Hmm, I can't reproduce it:

Dockerfile:

FROM fluent/fluentd:v1.15-1

# Use root account to use apk
USER root

RUN apk add --no-cache --update --virtual .build-deps \
        sudo build-base ruby-dev \
 && sudo gem install fluent-plugin-elasticsearch \
 && sudo gem sources --clear-all \
 && apk del .build-deps \
 && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem

Build:

docker build .
Sending build context to Docker daemon   2.56kB
Step 1/3 : FROM fluent/fluentd:v1.15-1
v1.15-1: Pulling from fluent/fluentd
2408cc74d12b: Already exists 
aa69f3b9770f: Pull complete 
702d0c034626: Pull complete 
0522d98f4673: Pull complete 
ebd920cb2e58: Pull complete 
Digest: sha256:5fdefb7258d63548fe27644994b4326e403a998d2763ab47fc4f45d92d620876
Status: Downloaded newer image for fluent/fluentd:v1.15-1
 ---> f3e86d9680ea
Step 2/3 : USER root
 ---> Running in e52e761a1a28
Removing intermediate container e52e761a1a28
 ---> 8a91994c1715
Step 3/3 : RUN apk add --no-cache --update --virtual .build-deps         sudo build-base ruby-dev  && sudo gem install fluent-plugin-elasticsearch  && sudo gem sources --clear-all  && apk del .build-deps  && rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
 ---> Running in 414cc684f690
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
(1/26) Installing sudo (1.9.10-r0)
(2/26) Installing libgcc (11.2.1_git20220219-r2)
(3/26) Installing libstdc++ (11.2.1_git20220219-r2)
(4/26) Installing binutils (2.38-r3)
(5/26) Installing libmagic (5.41-r0)
(6/26) Installing file (5.41-r0)
(7/26) Installing libgomp (11.2.1_git20220219-r2)
(8/26) Installing libatomic (11.2.1_git20220219-r2)
(9/26) Installing isl22 (0.22-r0)
(10/26) Installing mpfr4 (4.1.0-r0)
(11/26) Installing mpc1 (1.2.1-r0)
(12/26) Installing gcc (11.2.1_git20220219-r2)
(13/26) Installing musl-dev (1.2.3-r0)
(14/26) Installing libc-dev (0.7.2-r3)
(15/26) Installing g++ (11.2.1_git20220219-r2)
(16/26) Installing make (4.3-r0)
(17/26) Installing fortify-headers (1.1-r1)
(18/26) Installing patch (2.7.6-r7)
(19/26) Installing build-base (0.5-r3)
(20/26) Installing ruby-rdoc (3.1.2-r0)
(21/26) Installing libgmpxx (6.2.1-r2)
(22/26) Installing pkgconf (1.8.0-r0)
(23/26) Installing gmp-dev (6.2.1-r2)
(24/26) Installing libucontext-dev (1.2-r0)
(25/26) Installing ruby-dev (3.1.2-r0)
(26/26) Installing .build-deps (20220720.093020)
Executing busybox-1.35.0-r13.trigger
OK: 212 MiB in 52 packages
Successfully installed excon-0.92.3
Successfully installed multi_json-1.15.0
Successfully installed faraday-retry-1.0.3
Successfully installed faraday-rack-1.0.0
Successfully installed faraday-patron-1.0.0
Successfully installed faraday-net_http_persistent-1.2.0
Successfully installed faraday-net_http-1.0.1
Successfully installed multipart-post-2.2.3
Successfully installed faraday-multipart-1.0.4
Successfully installed faraday-httpclient-1.0.1
Successfully installed faraday-excon-1.1.0
Successfully installed faraday-em_synchrony-1.0.0
Successfully installed faraday-em_http-1.0.0
Successfully installed faraday-1.10.0
Successfully installed elastic-transport-8.0.1
Successfully installed elasticsearch-api-8.3.0
Successfully installed elasticsearch-8.3.0
Successfully installed fluent-plugin-elasticsearch-5.2.3
18 gems installed
*** Removed specs cache ***
(1/26) Purging .build-deps (20220720.093020)
(2/26) Purging sudo (1.9.10-r0)
(3/26) Purging build-base (0.5-r3)
(4/26) Purging file (5.41-r0)
(5/26) Purging g++ (11.2.1_git20220219-r2)
(6/26) Purging gcc (11.2.1_git20220219-r2)
(7/26) Purging binutils (2.38-r3)
(8/26) Purging libatomic (11.2.1_git20220219-r2)
(9/26) Purging libgomp (11.2.1_git20220219-r2)
(10/26) Purging make (4.3-r0)
(11/26) Purging libc-dev (0.7.2-r3)
(12/26) Purging musl-dev (1.2.3-r0)
(13/26) Purging fortify-headers (1.1-r1)
(14/26) Purging patch (2.7.6-r7)
(15/26) Purging ruby-dev (3.1.2-r0)
(16/26) Purging ruby-rdoc (3.1.2-r0)
(17/26) Purging gmp-dev (6.2.1-r2)
(18/26) Purging libgmpxx (6.2.1-r2)
(19/26) Purging libucontext-dev (1.2-r0)
(20/26) Purging libstdc++ (11.2.1_git20220219-r2)
(21/26) Purging libgcc (11.2.1_git20220219-r2)
(22/26) Purging libmagic (5.41-r0)
(23/26) Purging isl22 (0.22-r0)
(24/26) Purging mpc1 (1.2.1-r0)
(25/26) Purging mpfr4 (4.1.0-r0)
(26/26) Purging pkgconf (1.8.0-r0)
Executing busybox-1.35.0-r13.trigger
OK: 23 MiB in 26 packages
Removing intermediate container 414cc684f690
 ---> e63e32002c44
Successfully built e63e32002c44

@ashie ashie closed this as completed Jul 20, 2022
@ashie ashie moved this to Done in Fluentd Kanban Jul 20, 2022
@toyaser
Copy link
Author

toyaser commented Jul 20, 2022

@ashie as always thank you for your quick response, and I am sorry I didnt do my full testing. You are correct, after a little bit more research I found this docker-library/ruby#351 I was running docker version 19.03.6, build 369ce74a3c and once i upgraded to 20.10.7, build f0df350 it worked. Just wanted to put it here in case anyone runs into the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants