README.md in docker-api-1.22.4 vs README.md in docker-api-1.23.0
- old
+ new
@@ -10,11 +10,11 @@
------------
Add this line to your application's Gemfile:
```ruby
-gem 'docker-api', :require => 'docker'
+gem 'docker-api'
```
And then run:
```shell
@@ -208,10 +208,17 @@
# Create an Image from a Dockerfile.
# docker command for reference: docker build .
Docker::Image.build_from_dir('.')
# => Docker::Image { :id => 1266dc19e, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
+# Create an Image from a Dockerfile and stream the logs
+Docker::Image.build_from_dir('.') do |v|
+ if (log = JSON.parse(v)) && log.has_key?("stream")
+ $stdout.puts log["stream"]
+ end
+end
+
# Create an Image from a tar file.
# docker command for reference: docker build - < docker_image.tar
Docker::Image.build_from_tar(File.open('docker_image.tar', 'r'))
# => Docker::Image { :id => 1266dc19e, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
@@ -402,9 +409,15 @@
# Get the raw stream of data from an Exec instance
command = ["bash", "-c", "if [ -t 1 ]; then echo -n \"I'm a TTY!\"; fi"]
container.exec(command, tty: true)
# => [["I'm a TTY!"], [], 0]
+
+# Wait for the current command to finish executing. If an argument is given,
+# will timeout after that number of seconds. The default is one minute.
+command = ["bash", "-c", "if [ -t 1 ]; then echo -n \"Set max seconds for exec!!\"; fi"]
+container.exec(command, wait: 120)
+# => [["Set max seconds for exec!"], [], 0]
# Delete a Container.
container.delete(:force => true)
# => nil