I would like to know, given a binary's name, which package I should install on Alpine Linux.
How can I do that?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityYou have three ways basically.
First: The package should be installed and you need to specify the full path :
apk info --who-owns /path/to/the/file
Second: Use the pkgs.alpinelinux.org website
Third: Use the api.alpinelinux.org API by filtering the json output. For this you need a json parser like jq:
apk add jq
then use the API with the instructions provided here
I've released a tiny utility that allows to search via CLI what can be found on pkgs.alpinelinux.org website: https://github.com/fcolista/apkfile
.: Francesco
apk info
seems to be closer to dpkg -S
. In my case I'm trying to answer the question "What package provides this binary that I know the name of", rather than where does this pre-existing file come from.
apk info --who-owns /with/th/full/path
is the tool if you have the package installed, otherwise from a CLI is not possible. You should check [pkgs.alpinelinux.org/contents] (pkgs.alpinelinux.org/contents) website. You write the binary name there, and it returns the package that contains that binary.
Feb 16, 2017 at 8:02
apk info --who-owns
, how do you do if you don't know the file's full path?
Apr 17, 2018 at 15:20
You're looking for the equivalent of Debian's apt-file
for Alpine. Searching for that yields apk-file.
Basically apt-file but for alpine.
go get github.com/jessfraz/apk-file
(it happily runs on non alpine systems). The binary is likely static so can probably be copied into docker containers etc.
-d
option. And it doesn't strip whitespaces. And for some reason with --arch
it doesn't display all the results.
File
search bar, type the name of the file you are looking forExample looking for file telnet
:
given a binary's name, which package I should install on Alpine Linux.
The answer to the body of the question (not the same as the answer to the title of the question) is
apk search -xqa cmd:vim
(where vim
is the "binary's name"). In this case, there are two packages that provide that command.