Use the Docker Engine Api:Docker Engine API (v1.26)
And you can use GET/container/json will give you the details in json.
function getContainers(callback) {
    $.ajax({
        type: 'GET',
        url:  '/containers/json?all=1',
        dataType: 'json',
        success: function(data)
        {
          if( callback ) callback(data);
        },
        error: function(err)
        {
          // ...
        },
        timeout: 30000
    });
}