Explanation of the "--update add" command for Alpine Linux

In short:

To get the latest list of available packages, use the update command.

it is similar to the Debian apt-get update that you do before apt-get install my_package.

from https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Update_the_Package_list:

extract

Update the Package list

Remote repositories change as packages are added and upgraded. To get the latest list of available packages, use the update command. The command downloads the APKINDEX.tar.gz from each repository and stores it in the local cache, typically /var/cache/apk/, /var/lib/apk/ or /etc/apk/cache/.

apk update

Tip: If using remote repositories, it is a good idea to do an update just before doing an add or upgrade command. That way you know you are using the latest software available.


See https://github.com/gliderlabs/docker-alpine/pull/503

apk --update flag is really --update-cache.

Apk uses getopt_long (3), https://github.com/alpinelinux/apk-tools/blob/v2.10.3/src/apk.c#L574

So, --update flag is only abbreviated from --update-cache by getopt_long.

Long option names may be abbreviated if the abbreviation is unique or is an exact match for some defined option.