Operation not permitted when install run from make in docker build
I'm hitting a weird problem affecting the alpine docker image edge
but not latest
. Consider the following Dockerfile
:
FROM alpine:edge
RUN apk update && apk upgrade
RUN apk add --no-cache make
RUN mkdir /src /dist
COPY Makefile /src/Makefile
# run install without make
RUN install -m 0755 -D /bin/busybox /dist/other-bin/busybox
# run install with make
RUN make -C /src install-bin
And the following Makefile
:
install-bin:
install -m 0755 -D /bin/busybox /dist/bin/busybox
.PHONY: \
install
When issuing docker build .
on any travis env (xenial, bionic, focal), then the direct invocation of install
would succeed, and the one from within the Makefile
would fail reporting install: Operation not permitted
:
[...]
make: Entering directory '/src'
install -m 0755 -D /bin/busybox /dist/bin/busybox
make: Leaving directory '/src'
make: install: Operation not permitted
make: *** [Makefile:2: install-bin] Error 127
The command '/bin/sh -c make -C /src install-bin' returned a non-zero code: 2
This only affects edge
but not latest
. I cannot reproduce it locally but only on travis.
Full repros in znerol-scratch/alpine-travis-onp-repro and travis logs here.