0

I want to GET and present the web service states inside HTML dashboard. What is the most friendly and easy way to do it by JavaScript?

For example - When some docker is stopped i want to present a red led icon and when the response take long i want to present a yellow led icon and if it's ok.. you guess right, I want to present a green led icon.

Please your pro assistance. Thanks.

Idan E
  • 1,299
  • 4
  • 17
  • 42
  • Try this one: https://github.com/portainer/portainer This is an docker adminpanel running in your browser. Maybe you can copy some code and learn how to get the running containers. – Philip Apr 24 '17 at 08:48

1 Answers1

0

You will have to use the API provided by docker, see Docker Engine API (v1.26)

GET /containers/json will give you back the details you want in json format.

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
    });
}

Also:

Community
  • 1
  • 1
tgogos
  • 23,218
  • 20
  • 96
  • 128