Sign in

Universal mod

Package install

Installs any OS or Python packages named in INSTALL_PACKAGES and INSTALL_PIP_PACKAGES during container start, on Ubuntu and Alpine based images.

arch
amd64, arm64
built

Use it#

Set DOCKER_MODS on any LinuxServer.io container and recreate it. The mod is pulled on every start; several mods are separated with |.

DOCKER_MODS=ghcr.io/linuxserver-playground/mods:universal-package-install

:universal-package-install always gets the newest build. To stay on this one, pin its tag:

DOCKER_MODS=ghcr.io/linuxserver-playground/mods:universal-package-install-9361314
services:
  sonarr:
    image: ghcr.io/linuxserver-playground/sonarr:latest
    environment:
      - DOCKER_MODS=ghcr.io/linuxserver-playground/mods:universal-package-install

Settings#

VariableDefaultDescription
INSTALL_PACKAGESOS packages to install, separated by | (e.g. rsync|git|nginx). Names must match the distro repo (pkgs.alpinelinux.org or packages.ubuntu.com); pin a version with name=version on apt or name==version on apk.
INSTALL_PIP_PACKAGESPython packages to install with pip, separated by | (e.g. apprise or apprise==1.10.0). Setting it also installs python3-dev and pip, upgrades pip, setuptools and wheel, and adds the LinuxServer wheel index for the distro.

Details#

The packages are passed to apt-get install -y --no-install-recommends ... on Ubuntu and apk add --no-cache ... on Alpine based images for OS packages, and to pip install ... for Python packages. Set at least one of the two variables; with neither set the mod logs that there is nothing to install and exits.

E.g., to install the rsync, git and nginx OS packages and the apprise Python package, add the following lines to your compose service:

- DOCKER_MODS=ghcr.io/linuxserver-playground/mods:universal-package-install
- INSTALL_PACKAGES=rsync|git|nginx
- INSTALL_PIP_PACKAGES=apprise

Notes:

  • Package names entered should match the names in the relevant distro repo: https://pkgs.alpinelinux.org/packages or https://packages.ubuntu.com/
  • To install a specific version of a package include it in the name, e.g. apprise==1.10.0. apt requires a single =, while apk and pip use a double ==.
  • Setting INSTALL_PIP_PACKAGES results in the automatic install of the python3-dev and python3-pip OS packages, an update of pip to the latest version and installation of the latest setuptools and wheel packages to set up the necessary environment.
  • Any other OS dependency such as make or git that the pip install process may need should be added to INSTALL_PACKAGES manually.
  • The OS packages are installed first, followed by the pip packages.
  • Pip also uses the relevant LinuxServer wheel repo as an additional index to pull prebuilt wheels for common packages (https://wheel-index.linuxserver.io/ubuntu/ and https://wheel-index.linuxserver.io/alpine-3.16/).

Community project

Improve this mod, or make your own

Mods are how LinuxServer images grow without getting heavier: a Dockerfile, a few scripts and a mod.yml. If this one is missing something, or you need one like it for another image, an AI agent in our harness can build and test it with you.

Ask your agent

  • The universal-package-install mod <what is wrong>. Fix it, test it and draft the PR.
  • Make a mod like universal-package-install for <another image>, and test it.

Making a mod Every way to help Get the harness (opens in a new tab)

Source: universal-package-install branch (opens in a new tab). Every mod