I'm looking to install a version of grep in an Alpine Docker container thats a similar version to my host OS, v3.3. In hunting around online, I see the package is available for Alpine. However, on installation, in checking the version v3.1 is installed:

bash-4.4# grep --version
grep (GNU grep) 3.1

I figured maybe an explicit install is required, and specifying the version may do the trick. Then, I attempt:

bash-4.4# apk add --no-cache grep=3.3-r0
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
    breaks: world[grep=3.3-r0]
The command '/bin/sh -c apk add --no-cache bash grep=3.3-r0' returned a non-zero code: 1

Fair enough, I figure some other package explicitly depends on this version of grep. Figure, there's a package info command to hunt that down. After searching the interwebs, I gave this a go:

bash-4.4# apk info -a grep
WARNING: Ignoring APKINDEX.b89edf6e.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.737f7e01.tar.gz: No such file or directory
grep-3.1-r2 description:
Searches input files for lines containing a match to a specified pattern

grep-3.1-r2 webpage:

grep-3.1-r2 installed size:

grep-3.1-r2 depends on:

grep-3.1-r2 provides:

grep-3.1-r2 is required by:

grep-3.1-r2 contains:

grep-3.1-r2 triggers:

grep-3.1-r2 has auto-install rule:

grep-3.1-r2 affects auto-installation of:

grep-3.1-r2 replaces:

grep-3.1-r2 license:

No requirements for grep at that version, if I'm reading right.


The package of grep 3.3 is for the edge release, i.e. the development branch of Alpine Linux. Release 3.9, which you’re using, has grep 3.1.

If you really want it on your 3.9 system, you could always rebuild it by downloading the relevant package source and running abuild as appropriate.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.