Alpine Linux apk: List out directly installed packages by `apk add`?

Jonathan Dumaine asked:

Is it possible to list packages directly installed by apk add? e.g. apk add docker, apk add lm-sensors file, etc.

Running apk info lists ALL installed packages (including dependencies of installed packages), but I want to narrow this list down to top-level packages that are not dependencies of other packages in order to reproduce these packages on another system.

My answer:


You’re using the wrong tool.

You should use lbu to generate a package list or better yet an overlay file which you can use to bring an Alpine Linux system to a known set of packages.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.