Skip to content

How to get the exit code of a container? #2214

@sohail535

Description

@sohail535

Hi, this is more of a question than an issue.

Once I have a Container object of a container that exited ( possibly from client.run() ), how do I get the exit_code of that container? I looked at the documentation, it points me to container.status attribute, but it only gives a descriptive status of the container.

I can always do a subprocess.Popen and do this

docker inspect 61c6 --format='{{.State.ExitCode}}'

If the same data is available through something like container.exit_code it would be helpful.
Thanks 😄

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions