ikke-t / podman-container-systemd

creates systemd files and creates containers using podman
118 stars 44 forks source link

Passing arguments to container #6

Closed ChristianCiach closed 4 years ago

ChristianCiach commented 4 years ago

I need to pass arguments to the container. For example, when using the jenkins-lts image, I need to be able to pass the argument --prefix=/jenkins to make it work behind our reverse proxy.

A stripped down example for how I need to run the container:

podman run -p 8080:8080 -v /opt/jenkins/builds:/var/jenkins_home/builds jenkins/jenkins:lts --prefix=/jenkins

Using your role, it doesn't seem to be possible to pass the last argument to the container.

ChristianCiach commented 4 years ago

It seems like I can workaround this by using the JENKINS_OPTS="--prefix=/jenkins" for this specific image. But workarounds like these may not be possible for each and every image out there.

cfelder commented 4 years ago

I've the same issue using certbot images from docker hub.

Imho container_run_args should be renamed to container_run_flags as they reference flags for podman-run(1), but this would break backwards compatibility.

I'll prepare a pull request introducing container_cmd_args.

ikke-t commented 4 years ago

ok, I've never run into such case, but PR welcome. Typically you pass the container application parameters as environment variables, or mount some file into container. Note also you could use the podman kube format, the yaml way. That gives you endless options.