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: grep-3.1-r2: 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: https://www.gnu.org/software/grep/grep.html grep-3.1-r2 installed size: 192512 grep-3.1-r2 depends on: so:libc.musl-x86_64.so.1 so:libpcre.so.1 grep-3.1-r2 provides: cmd:egrep cmd:fgrep cmd:grep grep-3.1-r2 is required by: grep-3.1-r2 contains: bin/grep bin/egrep bin/fgrep 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: GPL-3.0+
No requirements for grep at that version, if I'm reading right.