# OS package registry (Ubuntu, Debian, Alpine)

Many applications and build dependencies are installed from your operating system's package repository, for example in a Dockerfile:

```
RUN apt update && apt install -y curl
```

When you aim for reliable and stable builds this is problematic:

1. This will install the latest version of the package. These package registries constantly update, and the command above will install the version of `curl` that was available whenever the container was built. This makes it impossible to have deterministic builds: packages will change whenever the build cache is empty (e.g. when you add a new build server); and your developers will all have a different set of packages, depending on when they built their containers.
2. Packages might be removed. E.g. Chromium used to be available on Ubuntu through apt, but was removed in favor of a snap version (which you can't easily install in a container).
3. Pinning of packages does not work, as older versions of packages are actively deleted from package registries. E.g.:\
   \
   `apt install -y curl=7.68.0-1ubuntu2.20`\
   \
   Might work today, but will fail when a new version of curl is released.

StableBuild solves all of these problems by creating a daily copy of the complete Ubuntu, Debian and Alpine Linux package registries - plus the most popular registries operated by others. You can thus pin your package list to a specific date, and this will return the exact same packages, regardless whether packages were modified or removed upstream. Example for Ubuntu:

```
ARG SB_API_KEY=your-api-key
ARG APT_PIN_DATE=2023-11-10T10:40:01Z

# Configure your OS to use StableBuild as the package registry
COPY ./sb-apt.sh /opt/sb-apt.sh
RUN bash /opt/sb-apt.sh load-apt-sources ubuntu

# Install your packages as usual, this'll always install curl 7.68.0 
RUN apt update && apt install -y curl
```

> We have daily copies going back to Sept. 6, 2023 (Ubuntu/Debian) and Dec. 17, 2023 (Alpine). You can browse the registry here: <http://debmirror.stablebuild.com/>.

And that's it. Your package list is now stable and reliable. 🎉

### What repositories are you mirroring?

The following repositories are mirrored:

**Ubuntu (18.04, 20.04, 22.04, 24.04):**

* [Official Ubuntu package repository](https://packages.ubuntu.com) for amd64, arm64 and armhf.
* [Nvidia CUDA repository](https://developer.download.nvidia.com/compute/cuda/repos/) for amd64 and arm64.
* [Deadsnakes PPA](https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa) (with up-to-date Python versions) for amd64, arm64 and armhf.
* [NodeSource PPA](https://deb.nodesource.com) (with up-to-date Node.js versions) for amd64, arm64 and armhf.
* [Docker CE PPA](/en/mirrors-and-caches/os-package-registry-ubuntu-debian-alpine.md) (with the Docker community edition) for amd64, arm64 and armhf.
* Chromium (from the official Debian package repository) for amd64 and arm64.
* [PostgreSQL PPA](https://wiki.postgresql.org/wiki/Apt) (with up-to-date PostgreSQL versions) for amd64 and arm64.
* [Ubuntu Toolchain test builds PPA](https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test) (with newer toolchains like gcc) for amd64, arm64 and armhf.
* [ROS1 PPA](http://packages.ros.org/ros/ubuntu) (with Robot Operating System packages) for amd64, arm64 and armhf.
* [Qualcomm IoT PPA](https://launchpad.net/~ubuntu-qcom-iot/+archive/ubuntu/qcom-ppa) (with Qualcomm AI and IoT software) for arm64.

Ubuntu 18.04 packages are only available in mirrors before 7 Dec 2025.

**Debian (10, 11, 12, 13)**

* [Official Debian package repository](https://www.debian.org/distrib/packages) for amd64, arm64 and armhf.
* [NodeSource PPA](https://deb.nodesource.com) (with up-to-date Node.js versions) for amd64, arm64 and armhf.
* [Docker CE PPA](/en/mirrors-and-caches/os-package-registry-ubuntu-debian-alpine.md) (with the Docker community edition) for amd64, arm64 and armhf.

Debian 10 packages are only available in mirrors before 7 Dec 2025.

**Alpine Linux (3.16 and up)**

* [Official Alpine Linux package repository](https://pkgs.alpinelinux.org/packages) for all architectures.

You can easily configure which sources to load in the dashboard. Select your operating system in the navigation bar, and then follow the instructions in the UI.

<figure><img src="/files/aM2FSx3V5wwq36YzNAfc" alt=""><figcaption><p>Choosing which repositories to mirror in the StableBuild dashboard</p></figcaption></figure>

We're happy to mirror any other (publicly available) repositories. Just email us at <support@stablebuild.com> and we'll add them.

### How about existing artifict management tools?

Existing artifact management tools try to deal with this problem by looking at all the packages that would be installed, downloading and mirroring the corresponding `.deb` or `.apk` files, and then installing those files instead of using the package manager. That works, but is problematic on a few levels:

1. When you want to modify your package list. E.g. you have curl 7.65 in cache. Months later you want to add a new package, but it's not in the cache yet, and the current version is dependent on curl 7.69 (and old versions are removed from the registry). Now you also need to update your existing package list - which might break your application.
2. When you want to move architectures. You have x86 packages cached, but now your developers are switching to macOS. You don't have the aarch64 packages in cache, so need to fully update all dependencies.

Because StableBuild has the complete historic package registry this is not an issue. You just add the new package to your `apt install` list and the version compatible with curl 7.65 will be fetched. And because we mirror all architectures, you can run the same command on aarch64 or armv7 - and get the same package list back for that architecture.

### Application specific notes

#### Installing Chromium on Ubuntu

Chromium used to be available through apt on Ubuntu systems, but now throws:

```
Command '/usr/bin/chromium-browser' requires the chromium snap to be installed.
Please install it with:

snap install chromium
```

StableBuild fixes this by installing the apt-compatible version of Chromium from the Debian registry. Under 'Which package repositories to include', choose "Chromium" and follow the instructions. Afterwards you can install Chromium again via apt (ran on Ubuntu 20.04):

```
$ apt install -y chromium
...
$ chromium --version
Chromium 120.0.6099.224 built on Debian 11.8, running on Debian bullseye/sid
```

The exact version of Chromium depends on the pin date.

For example:

* [`2023-11-10T10:40:01Z`](https://debmirror.stablebuild.com/2023-11-10T10:40:01Z/deb.debian.org/debian/pool/main/c/chromium/) contains Chromium 116.
* [`2023-09-30T10:40:01Z`](https://debmirror.stablebuild.com/2023-09-30T10:40:01Z/deb.debian.org/debian/pool/main/c/chromium/) contains Chromium 114.

To install chromedriver, for example to run integration tests, run:

```
$ apt install -y chromium-driver
...
$ chromedriver --version
ChromeDriver 120.0.6099.224 (3587067cafd6f5b1e567380acb485d96e623ef39-refs/branch-heads/6099@{#1761})
```

### Tips & tricks

#### Manually changing apt sources

You don't need to use `sb-apt.sh`. You can also manually update your `sources.list` files. Sources lines typically look like this:

```
deb [trusted=yes] http://your-domain.debmirror.stablebuild.com/2023-11-19T10:40:01Z/archive.ubuntu.com/ubuntu/ focal main restricted
```

Easiest is to open `sb-apt.sh` in your favourite editor, and you'll see how we add the source lines for all supported repositories.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stablebuild.gitbook.io/en/mirrors-and-caches/os-package-registry-ubuntu-debian-alpine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
