Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attach, read tty and send out CLI commands #521

Open
andrius opened this issue Mar 5, 2018 · 2 comments
Open

attach, read tty and send out CLI commands #521

andrius opened this issue Mar 5, 2018 · 2 comments

Comments

@andrius
Copy link

andrius commented Mar 5, 2018

My script should attach to the running container, grab tty input and based on content, send some data. (there is some telnet command that could produce various data sets from test device)

How I can do something like in pseudocode below?

container = Docker::Container.get('container-id-or-name')
a = container.attach
while true
  line = a.gets.to_s.chomp.strip
  break if line.empty?
  if line == 'value'
    a.puts "some-data"
  elsif line == '...'
    # ...
  end 
end
@wlchn
Copy link

wlchn commented Aug 23, 2018

Why not use websocket to attach a docker container. I'm using socket to attach, and it works fine.

@monsterooo
Copy link

@wlchn socket to attach ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants