containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.38k stars 208 forks source link

List supported toolbox images #1478

Open jelly opened 2 months ago

jelly commented 2 months ago

Is your feature request related to a problem? Please describe.

In Cockpit-podman we want to support creating toolbox images and further integration to allow a user to debug issues on an immutable system with a toolbox.

Describe the solution you'd like

We would like to be able to list supported toolbox images, toolbox offers a --distro and --release option but does not advertise which distro's and releases are supported. As a first step toolbox could list the supported Distributions using for example a new command line option distro:

$ toolbox distros
arch fedora rhel ubuntu

Optionally listing the container image.

$ toolbox distros --images
quay.io/toolbx/arch-toolbox:latest
registry.fedoraproject.org/fedora-toolbox:41

Or as alternative tabular output with supported versions:

DISTRO    RELEASE
arch         latest
fedora     all supported releases
rhel          8.5 and newer
ubuntu    all supported LTS and non-LTS releases

This would not help our UI, but might be useful for CLI users.

Optionally supporting machine readable json output would be nice, but not required.

This would prevent us from hardcoding the supported distributions in Cockpit-podman, we would love to also have the supported versions but this is a bit of a double edged sword. Hardcoding them in toolbox means they will get outdated quite fast, or require constant backporting to things like RHEL/Ubuntu.

I've investigated listing tags using the container registry, as we already talk to it in cockpit-podman. For example:

curl -X GET -s -g --no-buffer --unix-socket /run/user/1000/podman/podman.sock 'http://localhost/v1.12/libpod/images/search?term=quay.io/toolbx/ubuntu-toolbox&limit=2&listTags=true' | jq
[
  {
    "Index": "quay.io",
    "Name": "quay.io/toolbx/ubuntu-toolbox",
    "Description": "",
    "Stars": 0,
    "Official": "",
    "Automated": "",
    "Tag": "22.10"
  },

However for Fedora this get's more messy, the endpoint does not allow sorting and the tags get appended with a -$revision which means I would have to implement custom filtering in the UI. Alternatively we code-ify the version format of distributions, which toolbox also knows about:

[jelle@t14s][/tmp]%toolbox create --distro fedora -r 23.10
Error: invalid argument for '--release'
The release must be a positive integer.

Fedora example tags

curl -X GET -s -g --no-buffer --unix-socket /run/user/1000/podman/podman.sock 'http://localhost/v1.12/libpod/images/search?term=registry.fedoraproject.org/fedora-toolbox&limit=100&listTags=true' | jq -r '.[].Tag'
38-16
38-17
37-17
38-19
37-20
38-20
41-aarch64
41-ppc64le

Same situation for RHEL images:

9.3-10
9.3-10-source
9.3-12
9.3-12-source
9.3
9.3-14
latest
9.3-14-source

Describe alternatives you've considered

In an ideal world our UI would allow any valid toolbox image in the configured container registries to be used to create a toolbox. Podman's search API does not offer this functionality you can't filter on label=com.github.containers.toolbox.

A tool like skopeo can but is slow:

skopeo inspect docker://quay.io/toolbx/ubuntu-toolbox
{
    "Name": "quay.io/toolbx/ubuntu-toolbox",
    "Digest": "sha256:c0243f066ca403076318a4596aa109f0246d7c7d710cbd6e30d76c8aaf2081af",
    "RepoTags": [
        "22.10",
        "16.04",
        "22.04",
        "latest",
        "23.04",
        "20.04",
        "18.04",
        "23.10"
    ],
    "Created": "2024-04-08T00:23:33.499484028Z",
    "DockerVersion": "",
    "Labels": {
        "com.github.containers.toolbox": "true",
        "io.buildah.version": "1.23.1",
        "maintainer": "Ievgen Popovych \u003cjmennius@gmail.com\u003e",
        "name": "ubuntu-toolbox",
        "org.opencontainers.image.ref.name": "ubuntu",
        "org.opencontainers.image.version": "22.04",
        "summary": "Base image for creating Ubuntu Toolbx containers",
        "usage": "This image is meant to be used with the toolbox command",
        "version": "22.04"
    },
    "Architecture": "amd64",

Additional context Add any other context or screenshots about the feature request here. If a different tool has the functionality you're requesting, share it here.