bazel crashes if anything else is installed that upgrades musl
You can see a Dockerfile at https://github.com/dHannasch/bazel3-musl-test-Dockerfile/blob/master/Dockerfile . Initially, bazel can be installed and works perfectly.
Step 2/4 : RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ bazel3 && bazel --version
(60/60) Installing bazel3 (3.7.2-r0)
OK: 157 MiB in 74 packages
bazel 3.7.2- (@non-git)
However, things go wrong if we do anything that incidentally upgrades musl.
Step 3/4 : RUN apk add --no-cache --virtual .build-deps g++ && apk del --no-cache .build-deps
(1/14) Upgrading musl (1.2.2_pre6-r0 -> 1.2.2-r1)
(14/14) Installing .build-deps (20210210.192836)
OK: 337 MiB in 87 packages
(1/13) Purging .build-deps (20210210.192836)
(9/13) Purging musl-dev (1.2.2-r1)
OK: 157 MiB in 74 packages
Step 4/4 : RUN bazel --version
ERROR: No installed Bazel version found, cannot continue.
Bazel binaries have to be installed in /usr/bin, but none were found.
apk add musl=1.2.2_pre6-r0
does not work as a workaround, for unclear reasons.
Step 4/4 : RUN apk add --no-cache 'musl=1.2.2_pre6-r0'
ERROR: unable to select packages:
musl-1.2.2-r1:
breaks: world[musl=1.2.2_pre6-r0]
satisfies: libbsd-0.10.0-r0[musl>=1.1.16-r22]
While it's strange that we cannot downgrade musl even after removing the thing that upgraded musl in the first place, probably the solution here is to fix bazel so that bazel doesn't break when musl is upgraded. This might be resolved by !17500 (closed) .