Created
May 5, 2014 23:59
-
-
Save savaki/2879c27372dbc1cdc241 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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