Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] containers_create keyword arg "environment" fails json parse for List[str] #489

Open
jgperin opened this issue Dec 20, 2024 · 0 comments

Comments

@jgperin
Copy link

jgperin commented Dec 20, 2024

https://github.com/containers/podman-py/blob/main/podman/domain/containers_create.py

environment (Union[Dict[str, str], List[str]): Environment variables to set inside
                the container, as a dictionary or a List[str] in the format
                ["SOMEVARIABLE=xxx", "SOMEOTHERVARIABLE=xyz"].

...

 # Transform keywords into parameters
        params = {
             ...
             "env": pop("environment"),
        }

This fails like so

podman.errors.exceptions.APIError: 500 Server Error: Internal Server Error (decode(): json: cannot unmarshal array into Go struct field SpecGenerator.env of type map[string]string)

https://docs.podman.io/en/latest/_static/api.html#tag/containers/operation/ContainerCreateLibpod

object
Env is a set of environment variables that will be set in the container. Optional.

This will fail to parse unless passed as an object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant