I would like to know, given a binary's name, which package I should install on Alpine Linux.

How can I do that?


You 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

.: 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. – Att Righ Feb 15 '17 at 20:35
  • therefore, 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. – Francesco Colista Feb 16 '17 at 8:02
  • Using apk info --who-owns, how do you do if you don't know the file's full path? – Elouan Keryell-Even Apr 17 '18 at 15:20
  • No, you can't as yet...sorry – Francesco Colista Apr 18 '18 at 17:51

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.

  • 1
    That's what I'm after. It appears that apk-file is not an alpine package, you can install it with 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. – Att Righ Feb 15 '17 at 20:38
  • 1
    apt-file basically parses pkgs.alpinelinux.org website...so using a JSON decode as i wrote before would be better, since does not need bloated software to reach the same goal. – Francesco Colista Jul 3 '17 at 9:55

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.