Skip to content

Instantly share code, notes, and snippets.

@savaki
Created May 5, 2014 23:59
Show Gist options
  • Save savaki/2879c27372dbc1cdc241 to your computer and use it in GitHub Desktop.
Save savaki/2879c27372dbc1cdc241 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os/exec"
)
func main() {
tag := "ec2-xxx-xxx-xxx-xxx.us-west-1.compute.amazonaws.com:5000/sample/app:1.0.20"
command := fmt.Sprintf("docker run -i --rm -t %s /bin/bash -c 'cat /etc/hosts'", tag)
fmt.Println(command)
data, err := exec.Command("/bin/bash", "-c", command).CombinedOutput()
if err != nil {
panic(err)
}
fmt.Println(string(data))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment