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

Docker build failing since alpine:3.14 #603

Closed
squatica opened this issue Sep 18, 2021 · 5 comments · Fixed by #616
Closed

Docker build failing since alpine:3.14 #603

squatica opened this issue Sep 18, 2021 · 5 comments · Fixed by #616

Comments

@squatica
Copy link

Dockerfile uses FROM alpine which always pulls the :latest tag. In June 2021 alpine latest tag changed from 3.13 to 3.14 and now the builds are failing:

...
Step 4/14 : RUN 	cd /tmp/beanstalkd && 	make
--
135 | ---> Running in 21e33e2c80bf
136 | make: /bin/sh: Operation not permitted
137 | make: /bin/sh: Operation not permitted
138 | make: /bin/sh: Operation not permitted
139 | make: /bin/sh: Operation not permitted
140 | make: /bin/sh: Operation not permitted
141 | make: /bin/sh: Operation not permitted
142 | make: ./verc.sh: Operation not permitted
143 | make: /bin/sh: Operation not permitted
144 | cc   dat.h   -o .o
145 | make: cc: Operation not permitted
146 | make: *** [<builtin>: .o] Error 127
147 | The command '/bin/sh -c cd /tmp/beanstalkd && 	make' returned a non-zero code: 2
148 | time="2021-06-27T08:02:19Z" level=fatal msg="exit status 2"
@Neeteshking21
Copy link

Dockerfile uses FROM alpine which always pulls the :latest tag. In June 2021 alpine latest tag changed from 3.13 to 3.14 and now the builds are failing:

...
Step 4/14 : RUN 	cd /tmp/beanstalkd && 	make
--
135 | ---> Running in 21e33e2c80bf
136 | make: /bin/sh: Operation not permitted
137 | make: /bin/sh: Operation not permitted
138 | make: /bin/sh: Operation not permitted
139 | make: /bin/sh: Operation not permitted
140 | make: /bin/sh: Operation not permitted
141 | make: /bin/sh: Operation not permitted
142 | make: ./verc.sh: Operation not permitted
143 | make: /bin/sh: Operation not permitted
144 | cc   dat.h   -o .o
145 | make: cc: Operation not permitted
146 | make: *** [<builtin>: .o] Error 127
147 | The command '/bin/sh -c cd /tmp/beanstalkd && 	make' returned a non-zero code: 2
148 | time="2021-06-27T08:02:19Z" level=fatal msg="exit status 2"

you may find it on https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2

@squatica
Copy link
Author

Wow, thanks for the link. Turns out it happens only when building in a pipeline which uses docker:stable, which is still 19.03. So this is not directly a problem with beanstalk. It is related to drone-plugins/drone-docker#322 , but I suspect also gitlab still instructs people to use docker:stable in their pipelines by default.

A quick workaround would be to change the base image to alpine:3.13 because that's where it was working before and using base images with exact tagged versions is a good practice anyway.

@ysmolski
Copy link
Member

Thanks for looking into to. I agree that sticking to 3.13 would be the best solution. Can you please create pull request?

@SamMousa
Copy link
Contributor

SamMousa commented Jan 4, 2022

This issue is no longer valid.

using base images with exact tagged versions is a good practice anyway.

While this is true, in this case I'm not sure it really applies. Beanstalkd is a standalone binary afaik (correct me if I'm wrong).
So when we build it in a multistep build it doesn't matter what base version we use as long as it works.
Then we place it in a bare alpine container tagged with alpine:latest, if you want a different base container you can import it into your own:

FROM myownbase
COPY --from=ghcr.io/beanstalkd/beanstalkd:latest /usr/bin/beanstalkd /usr/bin/

Alternatively if you want to build it from source just append something like this to the dockerfile (including base docker file for readability):

FROM alpine as builder

RUN \
	apk -U upgrade --no-cache && \
	apk add --no-cache build-base git 

COPY . /tmp/beanstalkd
RUN \ 
	cd /tmp/beanstalkd && \
	make 

################################
FROM alpine

RUN apk -U upgrade --no-cache 

COPY --from=builder /tmp/beanstalkd/beanstalkd /usr/bin/

RUN mkdir /beanstalkd
EXPOSE 11300
ENTRYPOINT ["/usr/bin/beanstalkd"]


## Use my custom base image
FROM myownbaseimage
COPY --from=builder /tmp/beanstalkd/beanstalkd /usr/bin/

RUN my own preparation step

Looking at the original dockerfile again though I do see that we're running apk -U upgrade --no-cache which is actually not recommended since it's very bad for cache layering. I'll create a PR to remove that part.

@SamMousa
Copy link
Contributor

SamMousa commented Jan 4, 2022

Scrap my previous comment, forgot all about build args!
Have created a PR that supports using any base image.

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

Successfully merging a pull request may close this issue.

4 participants