Closed Danielside closed 10 months ago
The issue is with the way you created the secret:
echo "SECRET_VAL" | podman secret create test-secret -
By default, echo
adds a trailing newline. To avoid it you need to add -n
:
echo -n "SECRET_VAL" | podman secret create test-secret -
Issue Description
My goal is to deploy a laravel application in a ubuntu 22.04 server using Quadlet and images from my own registry, so I'd need a way to pass sensitive information to the containers without storing it in the images. One would expect that podman secrets would be the sensible choice.
My problem is that, either with systemd/quadlet units or with a simple podman run, the environment variable within the container appears with an extra carriage return, rendering them unusable.
Steps to reproduce the issue
Steps to reproduce the issue
git.cnmc.es:5050/liquid/liquid/nginx-liquid:20240109
. I start a session with the user for the rootless containers usingmachinectl shell liquid@
echo "SECRET_VAL" | podman secret create test-secret -
systemctl --user daemon-reload
systemctl --user start test
(no errors, container running, redis logs are correct)HOME=/root
liquid@madliquiddesapod:~$ podman run -d --secret="test-secret,type=env,target=TEST_SECRET" git.cnmc.es:5050/liquid/liquid/redis-liquid:20240109 a6aa90b56587cb7884ee9963770ba794e23abb65cf2c25c6c5c5ed05bc80aed5 liquid@madliquiddesapod:~$ podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9d1ff861e198 git.cnmc.es:5050/liquid/liquid/redis-liquid:20240109 bash 2 minutes ago Up 2 minutes test a6aa90b56587 git.cnmc.es:5050/liquid/liquid/redis-liquid:20240109 bash 2 seconds ago Up 2 seconds funny_lichterman liquid@madliquiddesapod:~$ podman exec funny_lichterman printenv PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin container=podman DEBIAN_FRONTEND=noninteractive LC_ALL=es_ES.UTF-8 TEST_SECRET=SECRET_VAL
HOME=/root
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
This is a VMWare virtual machine provided by my company. The base OS is Ubuntu 22.04, in which I have a very old version of podman so this installation is entirely from source. Except from catatonit, there is no podman component coming from the repos, all built from source or installed: go, netavark, slirp4netns, conmon, crun.
Additional information
This happens every time. And I can even reproduce it in Debian12/VirtualBox, with podman installed from the repos. Using the same redis image. Podman in debian 12 is 4.3.1