containers / containers/podlet

Special paths defined as env variables in system files should be mapped as systemd specifiers

Open
#53 9 comments 0 reactions 0 assignees View on GitHub
blocked enhancement help wanted
Dominant language
Rust
Stars
1.6k
Forks
48
Avg merge
1d 9h
Merged PRs (30d)
1

Description

## Example

E.g. say you have the following YAML:
```yml
version: "2.1"
services:
grocy:
image: lscr.io/linuxserver/grocy:latest
container_name: grocy
volumes:
- $HOME/config:/config:Z
ports:
- 9283:80
```

This currently get's mapped as (`Volume` matters here):
```ini
[Container]
ContainerName=grocy
Image=lscr.io/linuxserver/grocy:latest
PublishPort=9283:80
Volume=$HOME/config:/config:Z

[Service]
Restart=always

[Install]
WantedBy=default.target
```

## Problem
This does not work, as I dunno… some systemd thing…(?) I guess $HOME is not defined in that context.

in any case the error is something like if you want to start this Quadlet with podman:
> (podman)[82122]: grocy.service: Invalid environment variable name evaluates to an empty string: HOME/config:/config:Z

## Solution

It should replace some well-known env variables with their systemd equivalents.
`HOME` should be replaced with `%h` e.g.

Aka the result should be this:
```ini
Volume=%h/grocy-data:/config:Z
```

There are more such variables: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Specifiers

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the compose YAML volume value is converted into Quadlet systemd output, focusing on the handling of environment-variable paths. Check the generated unit against the systemd specifier documentation and verify that well-known variables such as HOME produce valid output like %h/config:/config:Z.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.