Comments (4)
@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.
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.
Cool.. all set. thanks
from docker-api.
Thanks @tlunter, @phantasm66!
from docker-api.
Related Issues (20)
- Docker::Image.create raises 404 when there is not enough disk space
- Feature request: support docker system calls.
- Warning: URI.escape is obsolete (Ruby 2.7.0) HOT 4
- warning: URI.escape is obsolete HOT 1
- undefined method `copy' on 2.0.0 HOT 2
- validate_version! doesn't exist HOT 2
- Please tag v2 releases in github
- Docker version in README
- Docker::Container.get throws `no implicit conversion of nil into String (TypeError)` Error
- The default connection type should be application/x-tar HOT 1
- The connection content_type should be modified based on the type of operation occuring
- Question: is BuildKit supported, for SSH credentials specifically? HOT 2
- Cannot use Docker API gem with Docker Desktop on Windows HOT 2
- Parameters that accept (string) Paths should also accept Pathname objects
- Ability to read a file from the container by chunks
- .dockerignore support seems broken
- class Docker::Plugin object that maps to the Plugins section of the API
- How to pass env variables when starting a container? HOT 1
- The `:host` parameter should not be set for `unix://` connections. HOT 1
- Docker::Event.stream documentation should mention how to waive the read_timeout HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-api.