Sign in

Universal mod

Docker

This mod adds the docker binary as wells as the buildx and the compose plug-ins to any linuxserver image.

arch
amd64, arm64
version
29.10.1-5.8.1
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-docker

:universal-docker always gets the newest build. To stay on this one, version 29.10.1-5.8.1, pin its tag:

DOCKER_MODS=ghcr.io/linuxserver-playground/mods:universal-docker-29.10.1-5.8.1

The control plane checks the upstream version every hour and builds the mod when a new one is out; the scheduler shows the latest check.

services:
  code-server:
    image: ghcr.io/linuxserver-playground/code-server:latest
    environment:
      - DOCKER_MODS=ghcr.io/linuxserver-playground/mods:universal-docker

Also for openvscode-server.

Details#

IMPORTANT NOTE: For docker access inside a container, a volume mapping needs to be added for /var/run/docker.sock:/var/run/docker.sock:ro in the container’s docker run/create/compose. If you’d like to connect to a remote docker service instead, you don’t have to map the docker sock; you can either set an env var for DOCKER_HOST=remoteaddress or use the docker cli option -H.

Security consideration:

Mapping docker.sock is a potential security liability because docker has root access on the host and any process that has full access to docker.sock would also have root access on the host. Docker api has no built-in way to set limitations on access, however you can use a proxy for the docker.sock via a solution like our docker socket proxy, which adds the ability to limit access. Then you would just set DOCKER_HOST= environment variable to point to the proxy address.

Here’s a sample compose yaml snippet for the socket proxy:

  dockerproxy:
    image: lscr.io/linuxserver/socket-proxy:latest
    container_name: dockerproxy
    environment:
      - CONTAINERS=1
      - POST=0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped
    read_only: true
    tmpfs:
      - /run

The above config for instance would allow read only access to list containers via the docker api. Then the env var in the container with the docker mod can be set as DOCKER_HOST=dockerproxy. This will allow the container to retrieve info on other containers, but it won’t be allowed to spin up new containers. With the proxy, you can fine tune the permissions very easily.

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-docker mod <what is wrong>. Fix it, test it and draft the PR.
  • Make a mod like universal-docker for <another image>, and test it.

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

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