Skip to content Skip to sidebar Skip to footer

Command Line Stdout To Array In Nodejs

I am trying to write a node.js application to interface with docker command line tool. My current code is as below: #!/usr/bin/env node var child_process = require('child_process'

Solution 1:

You can entertain yourself using unix tools like grep and awk, something like

docker ps | grep "wadmiraal/drupal" | awk '{print $1}' there you will have ids

It's okay when you use CLI, but if you write teh wrapper, things can go very uncomfortable way, because you will have to split strings, regex parse strings, join strings in arrays, argh.

BUT!

Thanks god, guys from docker team already have teh solution. It's called Docker Remote API , and I think it will fullfill your needs.


Post a Comment for "Command Line Stdout To Array In Nodejs"