-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
area/apiAPIAPI
Description
I'm using Ruby gem 'docker-api' with a Docker daemon running on a remote server.
I ran into timeout issue when I want to get output from running a command inside the container.
create an image
image = Docker::Image.create('fromImage'=>'base')
insert a local file into the image
image.insert_local('localPath'=>['/root/docker_scripts/install_prereqs.sh', '/root/docker_scripts/weaver_script.sh'], 'outputPath'=>'/tmp/')
get the image id from the response
image_data = eval("image.json")
puts image.json
image_id = image_data["id"]
inputs = Hash.new
inputs["Image"] = image_id
inputs["Cmd"] = ['ls -al']
create a container with the image id and the command 'ls -al'
myContainer = Docker::Container.create(inputs)
start the container and stream the output
myContainer.tap(&:start).attach {|stream,chunk| puts "#{stream}: #{chunk}"}
RESPONSE:
read time out reached
.docker_9f738e00-3424-0131-e558-525400c6ff8e [Status: failed]
Metadata
Metadata
Assignees
Labels
area/apiAPIAPI