简体   繁体   中英

Docker build with Alpine Linux causes segmentation fault

I've been using alpine/edge/community and I guess something changed under the hood recently because I'm not able to build an image from my docker file anymore and I get a seg fault instead.

Output:

Sending build context to Docker daemon  54.78kB

Step 1/6 : FROM ruby:2.5-alpine
2.5-alpine: Pulling from library/ruby

...

Status: Downloaded newer image for ruby:2.5-alpine
 ---> b14dcd6b80e9
Step 2/6 : RUN apk add --update build-base gcc && gem install bundler && mkdir -p /mnt/fileview
 ---> Running in f68bd52262b7
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/17) Installing binutils (2.35.1-r1)
(2/17) Installing libmagic (5.39-r0)
(3/17) Installing file (5.39-r0)
(4/17) Installing libgomp (10.2.1_pre1-r3)
(5/17) Installing libatomic (10.2.1_pre1-r3)
(6/17) Installing libgphobos (10.2.1_pre1-r3)
(7/17) Installing isl22 (0.22-r0)
[91mSegmentation fault (core dumped)
[0mThe command '/bin/sh -c apk add --update build-base gcc && gem install bundler && mkdir -p /mnt/fileview' returned a non-zero code: 139

Docker file:

FROM ruby:2.5-alpine
RUN apk add --update build-base gcc && gem install bundler && mkdir -p /mnt/fileview
WORKDIR /mnt/fileview
COPY * ./
RUN bundle install --deployment
CMD ["bundle", "exec", "ruby", "viewer_app.rb"]

It looks like isl22 was added as a dependency to alpine v3.13 aka the new latest version and that might be causing issues. However I'm not sure how to fix this.

Any guidance or help would be greatly appreciated.

I cannot build the given Dockerfile due to an error when invoking the bundle_install command:

DESKTOP-SI79RLD:~/test$ cat Dockerfile
FROM ruby:2.5-alpine
RUN apk add --update build-base gcc && gem install bundler && mkdir -p /mnt/fileview
WORKDIR /mnt/fileview
COPY * ./
RUN bundle install --deployment
CMD ["bundle", "exec", "ruby", "viewer_app.rb"]

DESKTOP-SI79RLD:~/test$ docker build .
[+] Building 1.2s (9/9) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 263B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/ruby:2.5-alpine                                                 0.7s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 257B                                                                                  0.0s
 => [1/5] FROM docker.io/library/ruby:2.5-alpine@sha256:009796beb93df8dc2d51aa07efd2b6e7e5b26504688e7ce0db25cec52  0.0s
 => CACHED [2/5] RUN apk add --update build-base gcc && gem install bundler && mkdir -p /mnt/fileview              0.0s
 => CACHED [3/5] WORKDIR /mnt/fileview                                                                             0.0s
 => [4/5] COPY * ./                                                                                                0.0s
 => ERROR [5/5] RUN bundle install --deployment                                                                    0.4s
------
 > [5/5] RUN bundle install --deployment:
#9 0.353 [DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local deployment 'true'`, and stop using this flag
#9 0.383 Could not locate Gemfile
------
executor failed running [/bin/sh -c bundle install --deployment]: exit code: 10

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM