Monitor container uptime and status Json Format

Hello,

I’m looking for the find a good solution to know the container status and uptime.
With the command line docker inspect I can have that I want but when I use this command line in my config, HA doesn’t understand :thinking:

  - platform: command_line
    name: Started Freshrss docker
    command: "docker inspect -f '{{ .State.StartedAt }}' freshrss"

with error messages :

TemplateSyntaxError: unexpected ‘.’

But I don’t how can I write correctly. Otherwise, I could use the command line with the “json_attributes”, but I didn’t find the good format to work well.

Thank you for your help.

Best to write that into a bash script and just execute that via HA.

You can check my post here for a simplish bash script to get docker info in JSON format.