docker inspect shows the container details.
Here’s how to parse out specific elements from docker inspect:
# .State is a HASH and keys are case sensitive docker inspect -f '{{ index .State "Status"}}' MQTT exited # .Args is a ARRAY and keys are zero based docker inspect -f '{{ index .Args 0}}' MQTT mosquitto # .Image has not children docker inspect -f '{{ index .Image}}' MQTT sha256:dceabd145c2b349f70c8157d1f63d595d6a963f0a257015df556bba80e34fc41 # .HostConfig is a HASH and .Binds is a ARRAY docker inspect -f '{{ index .HostConfig.Binds 0}}' MQTT /mnt/user/appdata/MQTT:/config:rw # .HostConfig, .LogConfig, & .Config are all HASHES, keys are case sensitive docker inspect -f '{{ index .HostConfig.LogConfig.Config "max-size"}}' MQTT 50m
See below for the “docker inspect MQTT” source snippet:
[ { "Id": "230f25a99bda02db9dcb948207ee34b7955f4922e034e8b1aaa6f8c441c59619", "Created": "2020-11-06T04:33:17.078059907Z", "Path": "/run.sh", "Args": [ "mosquitto" ], "State": { "Status": "exited", "Running": false, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 0, "ExitCode": 1, "Error": "", "StartedAt": "2025-02-17T00:53:16.19209215Z", "FinishedAt": "2025-02-17T00:53:16.475295616Z" }, "Image": "sha256:dceabd145c2b349f70c8157d1f63d595d6a963f0a257015df556bba80e34fc41", "ResolvConfPath": "/var/lib/docker/containers/230f25a99bda02db9dcb948207ee34b7955f4922e034e8b1aaa6f8c441c59619/resolv.conf", "HostnamePath": "/var/lib/docker/containers/230f25a99bda02db9dcb948207ee34b7955f4922e034e8b1aaa6f8c441c59619/hostname", "HostsPath": "/var/lib/docker/containers/230f25a99bda02db9dcb948207ee34b7955f4922e034e8b1aaa6f8c441c59619/hosts", "LogPath": "/var/lib/docker/containers/230f25a99bda02db9dcb948207ee34b7955f4922e034e8b1aaa6f8c441c59619/230f25a99bda02db9dcb948207ee34b7955f4922e034e8b1aaa6f8c441c59619-json.log", "Name": "/MQTT", "RestartCount": 0, "Driver": "btrfs", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/mnt/user/appdata/MQTT:/config:rw" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": { "max-file": "1", "max-size": "50m" } }, "NetworkMode": "bridge", "PortBindings": { "1883/tcp": [ { "HostIp": "", "HostPort": "1883" } ], "9001/tcp": [ { "HostIp": "", "HostPort": "9001" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "ConsoleSize": [ 0, 0 ],