Alpine Repository

Cloudsmith provides public & private repositories for Alpine Linux

835

Alpine Linux is a lightweight Linux Distribution that is designed to be smaller and more resource efficient, and as such has grown popular as the basis for Docker containers.

For more information on Alpine, please see:

Contextual Documentation

The examples in this document are generic. Cloudsmith provides contextual setup instructions within each repository, complete with copy n' paste snippets (with your namespace/repo/rsa-key pre-configured).

In the following examples:

IdentifierDescription
OWNERYour Cloudsmith account name or organisation name (namespace)
REPOSITORYYour Cloudsmith Repository name (also called "slug")
VERSIONAlpine distribution version, i.e v3.8. You can also use "any-version" if your package is compatible with more than more version
FINGERPRINTthe 8 Byte fingerprint of the Public RSA key for the repository
TOKENYour Cloudsmith Entitlement Token (see Entitlements for more details)
USERNAMEYour Cloudsmith username
PASSWORDYour Cloudsmith password
API-KEYYour Cloudsmith API Key
PACKAGE_NAMEThe name of your package
PACKAGE_VERSIONThe version number of your package

Upload a Package

Upload via the Cloudsmith CLI

For full details of how to install and setup the Cloudsmith CLI, see Command Line Interface.

The command to upload an Alpine package via the Cloudsmith CLI is:

cloudsmith push alpine OWNER/REPOSITORY/alpine/VERSION PACKAGE_NAME-PACKAGE_VERSION.apk

Example: Upload a package for Alpine v3.8

cloudsmith push alpine org/repo/alpine/v3.8 libjq-1.0.3.apk

Example: Upload a package for any version of Alpine

cloudsmith push alpine org/repo/alpine/any-version libjq-1.0.3.apk

Upload via Cloudsmith Website

Please see Upload a Package for details of how to upload via the Website UI.


Download / Install a Package

Setup

You have a choice of 3 methods to setup your Cloudsmith repository:

  • Automatic configuration (recommended)
  • Force a specific distribution/release (if your system is compatible but not identical)
  • Manual configuration

Public Repositories

To install Alpine packages from a public Cloudsmith repository , you can quickly set up the repository automatically:

sudo apk add --no-cache bash
curl -1sLf \
  'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash

If you need to force a specific distribution:

sudo apk add --no-cache bash
curl -1sLf \
  'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash

Or, you can manually configure the repository

curl -1sLf 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/[email protected]
curl -1sLf 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update

Private Repositories

📘

Private Cloudsmith repositories require authentication. You can choose between two types of authentication, Entitlement Token Authentication or HTTP Basic Authentication.

The setup method will differ depending on what authentication type you choose to use.

🚧

Entitlement Tokens, User Credentials and API-Keys should be treated as secrets and you should ensure that you do not commit them in configurations files along with source code, or expose them in any logs.

To install Alpine packages from a private Cloudsmith repository, you can quickly set up the repository automatically:

curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
| sudo bash
sudo apk add --no-cache bash
curl -u "USERNAME:PASSWORD" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash
sudo apk add --no-cache bash
curl -u "USERNAME:API-KEY" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash
sudo apk add --no-cache bash
curl -u "token:TOKEN" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo bash

If you need to force a specific distribution:

sudo apk add --no-cache bash
curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
| sudo distro=alpine codename=VERSION bash
sudo apk add --no-cache bash
curl -u "USERNAME:PASSWORD" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash
sudo apk add --no-cache bash
curl -u "USERNAME:API-KEY" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash
sudo apk add --no-cache bash
curl -u "token:TOKEN" -1sLf \
  'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/bash.alpine.sh' \
  | sudo distro=alpine codename=VERSION bash

Or, you can manually configure the repository:

curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/[email protected]
curl -1sLf 'https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update
curl -u "USERNAME:PASSWORD" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/[email protected]
curl -u "USERNAME:PASSWORD" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update
curl -u "USERNAME:API-KEY" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/[email protected]
curl -u "USERNAME:API-KEY" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update
curl -u "token:TOKEN" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/rsa/rsa.FINGERPRINT.key' > /etc/apk/keys/[email protected]
curl -u "token:TOKEN" -1sLf 'https://dl.cloudsmith.io/basic/OWNER/REPOSITORY/cfg/setup/config.alpine.txt?distro=alpine&codename=VERSION' >> /etc/apk/repositories
apk update

Installing a package

After you have set up the repository, to install a package you do:

sudo apk add PACKAGE_NAME=PACKAGE_VERSION --update-cache

Removing Setup

If you no longer want to install packages from your Cloudsmith repository, you can remove it with:

$EDITOR /etc/apk/repositories

Remove the /alpine/VERSION/main line, save then execute:

rm -f /etc/apk/keys/[email protected]
apk update

Upstream Proxying / Caching

Not Supported

Key Signing Support

RSA Index

Troubleshooting

Please see the Troubleshooting page for further help and information.


Cloudsmith is the new standard in Package / Artifact Management and Software Distribution

With support for all major package formats, you can trust us to manage your software supply chain.


Start My Free Trial Now
Cookie Declaration (Manage Cookies)