containers / podlet

Generate Podman Quadlet files from a Podman command, compose file, or existing object
https://crates.io/crates/podlet
Mozilla Public License 2.0
322 stars 10 forks source link

hostuser gets misinterpreted as podman args #41

Closed skewballfox closed 6 months ago

skewballfox commented 6 months ago

This might be user error, but it seems that hostuser isn't being interpreted as a command for podlet podman run.

I'm running this command:

podlet --requires network-online.target --description 'Owncloud Infinite Scale' --install $(cat ./ocis_start.sh| tr "\\" " " | sed s/"-it"//g) --user 1000 --hostuser ocis

where the content of the ocis_start.sh is this:

podman run \
    --name ocis_runtime \
    --rm \
    -it \
    -p 9200:9200 \
    --volume $PWD/ocis/ocis-config:/etc/ocis:Z,U \
    --volume $PWD/ocis/ocis-data:/var/lib/ocis:Z,U \
    -e OCIS_INSECURE=true \
    -e PROXY_HTTP_ADDR=0.0.0.0:9200 \
    -e OCIS_URL=https://<hostname>:9200 \
    owncloud/ocis

which produces the following output:

# ocis_runtime.container
[Unit]
Description=Owncloud Infinite Scale
Requires=network-online.target

[Container]
ContainerName=ocis_runtime
Environment=OCIS_INSECURE=true PROXY_HTTP_ADDR=0.0.0.0:9200 OCIS_URL=https://<hostname>:9200
Image=owncloud/ocis
PodmanArgs=--hostuser ocis
PublishPort=9200:9200
User=1000
Volume=$PWD/ocis/ocis-config:/etc/ocis:Z,U
Volume=$PWD/ocis/ocis-data:/var/lib/ocis:Z,U

[Install]
WantedBy=default.target

ocis is a user listed under /etc/passwd . I'm running podlet version 0.2.2, the most recent available on cargo. Most of the other commands I've tried so far have worked. Still trying to make sense of the code, so I might be misinterpreting what's happening, but it looks like you are constructing the quadlet options from podman args, but hostuser seems to be missing from quadlet options.

skewballfox commented 6 months ago

So I might have misinterpreted the purpose of the --hostuser flag. The archived quadlet repo had a test where they used a HostUser field, and discussed it's use in the docs on uid/gid mapping, but looking at the docs for quadlet in podman that option is missing and looking through the commit history it has been replaced by RemapUser.

Sorry for the confusion. I'll close this