Publish Alpine packages.
To work with the APK registry, you need either the lkar client or an HTTP client like curl to upload and finally, a
package manager like apk to install packages.
The following examples use apk.
| Placeholder | Description |
|---|---|
image |
The oci image used as backend. |
branch |
The branch to use. |
repository |
The repository to use. |
username |
The repository user. |
password_or_token |
The repository password or token. |
architecture |
The package architecture. |
filepath |
The path to the file to delete. |
If the registry is private, start by log in the registry:
lkar login artifact-registry.example.orglkar login artifact-registry.example.org/<image>lkar login apk.example.orglkar login apk.example.org/<image>To setup the APK registry on the local machine, run the following command:
lkar apk setup artifact-registry.example.org <branch> <repository>lkar apk setup artifact-registry.example.org/<image> <branch> <repository>lkar apk setup apk.example.org <branch> <repository>lkar apk setup apk.example.org/<image> <branch> <repository>If the registry is private, provide credentials in the url:
https://<username>:<password_or_token>@<url>
To register the Alpine registry using the repository script, run the following command:
curl -s https://artifact-registry.example.org/apk/<branch>/<repository>/setup | shcurl -s https://artifact-registry.example.org/apk/<image>/<branch>/<repository>/setup | shcurl -s https://apk.example.org/<branch>/<repository>/setup | shcurl -s https://apk.example.org/<image>/<branch>/<repository>/setup | shIf the registry is private, provide credentials in the url:
https://<username>:<password_or_token>@<url>
To register the Alpine registry add the url to the list of known apk sources (/etc/apk/repositories):
https://artifact-registry.example.org/apk/<branch>/<repository>
https://artifact-registry.example.org/apk/<image>/<branch>/<repository>
https://apk.example.org/<branch>/<repository>
https://apk.example.org/<image>/<branch>/<repository>
The Alpine registry files are signed with a RSA key which must be known to apk.
From the /etc/apk/keys/ directory, download the public key:
curl -JO https://artifact-registry.example.org/apk/keycurl -JO https://apk.example.org/keyAfterward, update the local package index:
apk updateTo publish an APK package, run the following command:
lkar apk push artifact-registry.example.org <branch> <repository> path/to/file.apklkar apk push artifact-registry.example.org/<image> <branch> <repository> path/to/file.apklkar apk push apk.example.org <branch> <repository> path/to/file.apklkar apk push apk.example.org/<image> <branch> <repository> path/to/file.apkTo publish an APK package, perform an HTTP PUT operation with the package content in the request body.
https://artifact-registry.example.org/apk/<branch>/<repository>/push
Example request using HTTP Basic authentication:
curl --user username:password_or_token \
--upload-file path/to/file.apk \
https://artifact-registry.example.org/apk/v3.17/main/pushhttps://artifact-registry.example.org/apk/<image>/<branch>/<repository>/push
Example request using HTTP Basic authentication:
curl --user username:password_or_token \
--upload-file path/to/file.apk \
https://artifact-registry.example.org/apk/user/image/v3.17/main/pushhttps://apk.example.org/<branch>/<repository>/push
Example request using HTTP Basic authentication:
curl --user username:password_or_token \
--upload-file path/to/file.apk \
https://apk.example.org/v3.17/main/pushhttps://apk.example.org/<image>/<branch>/<repository>/push
Example request using HTTP Basic authentication:
curl --user username:password_or_token \
--upload-file path/to/file.apk \
https://apk.example.org/user/image/v3.17/main/pushTo delete an APK package, run the following commands:
First retrieve the path to package you want to delete:
lkar apk ls artifact-registry.example.org <branch> <repository>Then use the path to delete the package:
lkar apk rm artifact-registry.example.org <path>First retrieve the path to package you want to delete:
lkar apk ls artifact-registry.example.org/<image> <branch> <repository>Then use the path to delete the package:
lkar apk rm artifact-registry.example.org/<image> <path>First retrieve the path to package you want to delete:
lkar apk ls apk.example.org <branch> <repository>Then use the path to delete the package:
lkar apk rm apk.example.org <path>First retrieve the path to package you want to delete:
lkar apk ls apk.example.org/<image> <branch> <repository>Then use the path to delete the package:
lkar apk rm apk.example.org/<image> <path>To delete an APK package, first retrieve the path to the package in the repository:
GET https://artifact-registry.example.org/_packages/apk
Then perform an HTTP DELETE operation. This will delete the package version too if there is no
file left.
DELETE https://artifact-registry.example.org/apk/<branch>/<repository>/<architecture>/<filename>
Example request using HTTP Basic authentication:
curl --user username:password_or_token -X DELETE \
https://artifact-registry.example.org/apk/v3.17/main/test-package-1.0.0.apkTo delete an APK package, first retrieve the path to the package in the repository:
GET https://artifact-registry.example.org/_packages/apk/<image>
Then perform an HTTP DELETE operation. This will delete the package version too if there is no
file left.
DELETE https://artifact-registry.example.org/apk/<image>/<branch>/<repository>/<architecture>/<filename>
Example request using HTTP Basic authentication:
curl --user username:password_or_token -X DELETE \
https://artifact-registry.example.org/apk/user/image/v3.17/main/test-package-1.0.0.apkTo delete an APK package, first retrieve the path to the package in the repository:
GET https://apk.example.org/_packages
Then perform an HTTP DELETE operation. This will delete the package version too if there is no
file left.
DELETE https://apk.example.org/<branch>/<repository>/<architecture>/<filename>
Example request using HTTP Basic authentication:
curl --user username:password_or_token -X DELETE \
https://apk.example.org/v3.17/main/test-package-1.0.0.apkTo delete an APK package, first retrieve the path to the package in the repository:
GET https://apk.example.org/_packages/<image>
Then perform an HTTP DELETE operation. This will delete the package version too if there is no
file left.
DELETE https://apk.example.org/<image>/<branch>/<repository>/<architecture>/<filename>
Example request using HTTP Basic authentication:
curl --user username:password_or_token -X DELETE \
https://apk.example.org/user/image/v3.17/main/test-package-1.0.0.apkTo install a package from the APK registry, execute the following commands:
# use latest version
apk add {package_name}
# use specific version
apk add {package_name}={package_version}