Skip to content

Latest commit

 

History

History
151 lines (97 loc) · 2.13 KB

alpine.md

File metadata and controls

151 lines (97 loc) · 2.13 KB

Alpine

https://wiki.alpinelinux.org

Minimal Linux distribution used mainly to create small Docker images.

Uses busybox all-in-one binary with minimal core shell and coreutils functionality.

Replaced libc with musl core library which sometimes causes problems with progam compiling or grep buggy behaviour.

Package Management

https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management

Repositories

/etc/apk/repositories

Get the latest package lists:

apk update

Search

Search packages for anything with the word "$name" in it:

apk search "$name"

Show all packages:

apk search

Show all packages and versions:

apk search -v

Install / Uninstall Packages

Install a given package:

apk add "$pkg"

On Alpine 3+ you can skip the prerequisite apk update by adding the -u switch to add:

apk add -u "$pkg"

Uninstall package:

apk del "$pkg"

Delete the local package list cache:

(usually done at the end of a Dockerfile RUN to not save it to the docker image)

apk cache clean

Info

List packages:

apk info

Show versions:

apk -v info

Show versions + descriptions:

apk -vv info

Find which package installed a given file on disk:

apk info --who-owns /bin/sh

Show package contents:

apk info -L <pkg>

Show all info on package:

apk info -a "$pkg"

Upgrades

Upgrade system, all packages:

apk upgrade

Upgrade specific package:

apk add --upgrade "$pkg"

apk-file

https://github.com/genuinetools/apk-file

apt-file but for Alpine, finds

Go binary that searches which packages contain a given filename.

docker run --rm -ti jess/apk-file <file>

Ported from private Knowledge Base page 2015+