From 7e6ede63794b54bcc0d67d86ea60e76b701d286f Mon Sep 17 00:00:00 2001 From: Louis Opter Date: Tue, 4 Jun 2013 15:24:25 -0700 Subject: [PATCH] Print the container id before the hijack in `docker run` (see also #804) This is useful when you want to get the container id before you start to interact with stdin (which is what I'm doing in dotcloud/sandbox). --- commands.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands.go b/commands.go index f12e9bcb11..71a6f87e04 100644 --- a/commands.go +++ b/commands.go @@ -1228,6 +1228,9 @@ func (cli *DockerCli) CmdRun(args ...string) error { return err } + if !config.AttachStdout && !config.AttachStderr { + fmt.Println(out.ID) + } if connections > 0 { chErrors := make(chan error, connections) cli.monitorTtySize(out.ID) @@ -1262,9 +1265,6 @@ func (cli *DockerCli) CmdRun(args ...string) error { connections -= 1 } } - if !config.AttachStdout && !config.AttachStderr { - fmt.Println(out.ID) - } return nil }