Skip to content
Snippets Groups Projects
Commit a83398b6 authored by Simon McVittie's avatar Simon McVittie
Browse files

system-info: Add support for detecting Podman


Podman is a lot like Docker, but can run unprivileged.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent c9b752ed
No related branches found
No related tags found
1 merge request!220Improve container detection
Pipeline #7455 passed
...@@ -3469,6 +3469,7 @@ static const ContainerTypeName container_types[] = ...@@ -3469,6 +3469,7 @@ static const ContainerTypeName container_types[] =
{ {
{ SRT_CONTAINER_TYPE_DOCKER, "docker" }, { SRT_CONTAINER_TYPE_DOCKER, "docker" },
{ SRT_CONTAINER_TYPE_FLATPAK, "flatpak" }, { SRT_CONTAINER_TYPE_FLATPAK, "flatpak" },
{ SRT_CONTAINER_TYPE_PODMAN, "podman" },
{ SRT_CONTAINER_TYPE_PRESSURE_VESSEL, "pressure-vessel" }, { SRT_CONTAINER_TYPE_PRESSURE_VESSEL, "pressure-vessel" },
}; };
...@@ -3566,6 +3567,14 @@ ensure_container_info (SrtSystemInfo *self) ...@@ -3566,6 +3567,14 @@ ensure_container_info (SrtSystemInfo *self)
goto out; goto out;
} }
if (_srt_file_test_in_sysroot (self->sysroot, self->sysroot_fd,
"/run/.containerenv", G_FILE_TEST_EXISTS))
{
self->container.type = SRT_CONTAINER_TYPE_PODMAN;
g_debug ("Podman based on /run/.containerenv");
goto out;
}
if (_srt_file_get_contents_in_sysroot (self->sysroot_fd, if (_srt_file_get_contents_in_sysroot (self->sysroot_fd,
"/proc/1/cgroup", "/proc/1/cgroup",
&contents, NULL, NULL)) &contents, NULL, NULL))
......
...@@ -82,6 +82,7 @@ typedef enum ...@@ -82,6 +82,7 @@ typedef enum
* @SRT_CONTAINER_TYPE_PRESSURE_VESSEL: Running in a Steam Runtime container * @SRT_CONTAINER_TYPE_PRESSURE_VESSEL: Running in a Steam Runtime container
* using pressure-vessel * using pressure-vessel
* @SRT_CONTAINER_TYPE_DOCKER: Running in a Docker container * @SRT_CONTAINER_TYPE_DOCKER: Running in a Docker container
* @SRT_CONTAINER_TYPE_PODMAN: Running in a Podman container
* *
* A type of container. * A type of container.
*/ */
...@@ -91,6 +92,7 @@ typedef enum ...@@ -91,6 +92,7 @@ typedef enum
SRT_CONTAINER_TYPE_FLATPAK, SRT_CONTAINER_TYPE_FLATPAK,
SRT_CONTAINER_TYPE_PRESSURE_VESSEL, SRT_CONTAINER_TYPE_PRESSURE_VESSEL,
SRT_CONTAINER_TYPE_DOCKER, SRT_CONTAINER_TYPE_DOCKER,
SRT_CONTAINER_TYPE_PODMAN,
SRT_CONTAINER_TYPE_UNKNOWN = -1 SRT_CONTAINER_TYPE_UNKNOWN = -1
} SrtContainerType; } SrtContainerType;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment