Giter Club home page Giter Club logo

Comments (4)

tlunter avatar tlunter commented on July 20, 2024

@phantasm66, I think you're confusing a hash with how we're representing the objects.

We don't actually return only a hash, but instead an array of objects that can be acted upon with methods like: container.json, container.start, container.stop, etc.

These can be found in the README here.

Docker does do quite a bit of data mashing underneath the CLI when doing certain methods, so you won't find an exact 1-to-1 mapping, but we try and emulate it as much as possible.

Let me know if this doesn't help

from docker-api.

phantasm66 avatar phantasm66 commented on July 20, 2024

Ah, ok...

containers = Docker::Container.all({:all => true})

=> [Docker::Container { :id => f9557322025a6b470dbad7d73f5e3fa7edb882c0b8e420a2ba821a8afa55de75, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => 7b2fa7289d3a0defead5a148a66af2c73aa688326347161fe85b16c4d14d7743, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => bd3998c940145e93bde0f357a139ef7a369f7cef375ea59d53f85865be8e3487, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => 742a127a5fb7ac717173c609477e528e66af3985c49cbcdd20c340fa122f7021, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => e615ea13aa174e8e9169469838255e13bf30cf1e24499f4b1fbf963395657065, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => de3d0e9013d437caba4bc37a005efccb6fc3d15dab3edc511000dbe453f9b6d1, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => 2c9f005cd5754f8e772de450b83ba26cec81f8818d85248312a98aaae5597b9b, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => 56bb3e8c71f179b013514a7b45490ec37f24f08d72f58716cefaf034ba20a7ef, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => bc8e3cb93bb315a82ab433b712f56204a1f94808e5f90e7522d434c51f177199, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }, Docker::Container { :id => 8f9d0d81f1cba7d551e539daed2559c7ca756b198f6b889f939cc9cc7df64b18, :connection => Docker::Connection { :url => unix:///, :options => {:socket=>"/var/run/docker.sock"} } }]

Then...

containers.each {|container| pp container.json}

{"ID"=>"f9557322025a6b470dbad7d73f5e3fa7edb882c0b8e420a2ba821a8afa55de75",
 "Created"=>"2014-04-30T02:45:28.371621115Z",
 "Path"=>"execute_stuff.sh",
 "Args"=>["mta-test1.test.com"],
 "Config"=>
  {"Hostname"=>"mta-test1",
   "Domainname"=>"test.com",
   "User"=>"",
   "Memory"=>0,
   "MemorySwap"=>0,
   "CpuShares"=>0,
   "AttachStdin"=>false,
   "AttachStdout"=>false,
   "AttachStderr"=>false,
   "PortSpecs"=>nil,
.........

from docker-api.

phantasm66 avatar phantasm66 commented on July 20, 2024

Cool.. all set. thanks

from docker-api.

bfulton avatar bfulton commented on July 20, 2024

Thanks @tlunter, @phantasm66!

from docker-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.