I want to install Alpine packages like python in a Docker image, but when I run docker build - < Dockerfile
(or build using IntelliJ) I get
ERROR: unsatisfiable constraints:
/bin/sh (virtual):
provided by: busybox
required by:
alpine-baselayout-3.1.0-r0[/bin/sh]
alpine-baselayout-3.1.0-r0[/bin/sh]
The command '/bin/sh -c apk add --update python' returned a non-zero code: 2
I am using the following Dockerfile which I derived from the docs at github.com/gliderlabs/docker-alpine/blob/master/docs/usage.md
FROM gliderlabs/alpine:latest
RUN apk add --update python
Same error when using the docker image interactively
When I use docker run -it gliderlabs/alpine:latest /bin/sh
and then apk add --update python
or apk add python
I get the same error.
When I do apk update
I get OK: 9543 distinct packages available
, but when I do apk upgrade
I get the same error.
System information
I am using Arch Linux 4.19.8.
The Image ID of gliderlabs/alpine:latest is sha256:673b8178133a04ed1de21d6cf1a729f8aaf9469d4550005ede89e7142efd9459
.
The output of docker run gliderlabs/alpine:latest which apk
is /sbin/apk
.
The docker version is 18.09.0-ce.
Relevant other information
Docker Alpine /bin/sh apk not found looks similar (though on CentOS) but has no resolution, one comment links to:
/bin/sh: 1: apk: not found while creating docker image but the answer is to switch to apk
which I'm doing already (the docs are pretty clear about this).
Docker: Using apt-key with alpine image also suggests to use apk add
which is what I'm doing.
Edit
As suggested by @larsks, you can run apk search --update python | grep '^python'
and it shows me that I have python3-3.6.6-r0
availabe but not python
. However, when I try apk add python3-3.6.6-r0
I get
ERROR: unsatisfiable constraints:
python3-3.6.6-r0 (missing):
required by: world[python3-3.6.6-r0]
/bin/sh (virtual):
provided by: busybox
required by: alpine-baselayout-3.1.0-r0[/bin/sh] alpine-baselayout-3.1.0-r0[/bin/sh]
Also, this wouldn't explain why apk upgrade
fails with the same error as apk add python
.
When I try apk add --update python3
I get
fetch http://alpine.gliderlabs.com/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://alpine.gliderlabs.com/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
/bin/sh (virtual):
provided by: busybox
required by: alpine-baselayout-3.1.0-r0[/bin/sh] alpine-baselayout-3.1.0-r0[/bin/sh]