Skip to content

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

Open
@jgperin

Description

@jgperin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions