From 14d9f04e8971effcab45e76c5a69f6d997fb83dd Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Mon, 25 Nov 2013 23:20:36 -0800 Subject: [PATCH 1/8] fix docker run on an unknown image --- commands.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 21b2e72c28..6f0954c42c 100644 --- a/commands.go +++ b/commands.go @@ -2009,8 +2009,7 @@ func (cli *DockerCli) CmdRun(args ...string) error { if body, _, err = cli.call("POST", "/containers/create?"+containerValues.Encode(), config); err != nil { return err } - } - if err != nil { + } else if err != nil { return err } From 0d078b65817fc91eba916652b3f087a6c2eef851 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 26 Nov 2013 00:05:46 -0800 Subject: [PATCH 2/8] fix -link parsing --- commands.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands.go b/commands.go index 6f0954c42c..d992db2e6c 100644 --- a/commands.go +++ b/commands.go @@ -1650,11 +1650,12 @@ func (opts AttachOpts) Set(val string) error { // LinkOpts stores arguments to `docker run -link` type LinkOpts []string -func (link LinkOpts) String() string { return fmt.Sprintf("%v", []string(link)) } -func (link LinkOpts) Set(val string) error { +func (link *LinkOpts) String() string { return fmt.Sprintf("%v", []string(*link)) } +func (link *LinkOpts) Set(val string) error { if _, err := parseLink(val); err != nil { return err } + *link = append(*link, val) return nil } @@ -1760,7 +1761,7 @@ func parseRun(cmd *flag.FlagSet, args []string, capabilities *Capabilities) (*Co cmd.Var(flAttach, "a", "Attach to stdin, stdout or stderr.") cmd.Var(flVolumes, "v", "Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)") - cmd.Var(flLinks, "link", "Add link to another container (name:alias)") + cmd.Var(&flLinks, "link", "Add link to another container (name:alias)") cmd.Var(&flPublish, "p", fmt.Sprintf("Publish a container's port to the host (format: %s) (use 'docker port' to see the actual mapping)", PortSpecTemplateFormat)) cmd.Var(&flExpose, "expose", "Expose a port from the container without publishing it to your host") From e39d35dedad1db952c30958303902b4c96e1f406 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 5 Dec 2013 16:32:02 -0800 Subject: [PATCH 3/8] Bump to 0.7.1 --- CHANGELOG.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ VERSION | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdd91eaddc..86e3b88484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,61 @@ # Changelog +## 0.7.1 (2013-12-05) + +#### Documentation + ++ Add @SvenDowideit as documentation maintainer ++ Add links example ++ Add documentation regarding ambassador pattern ++ Add Google Cloud Platform docs ++ Add dockerfile best practices +* Update doc for RHEL +* Update doc for registry +* Update Postgres examples +* Update doc for Ubuntu install +* Improve remote api doc + +#### Runtime + ++ Add hostconfig to docker inspect ++ Implement `docker log -f` to stream logs ++ Add env variable to disable kernel version warning ++ Add -format to `docker inspect` ++ Support bind-mount for files +- Fix bridge creation on RHEL +- Fix image size calculation +- Make sure iptables are called even if the bridge already exists +- Fix issue with stderr only attach +- Remove init layer when destroying a container +- Fix same port binding on different interfaces +- `docker build` now returns the correct exit code +- Fix `docker port` to display correct port +- `docker build` now check that the dockerfile exists client side +- `docker attach` now returns the correct exit code +- Remove the name entry when the container does not exist + +#### Registry + +* Improve progress bars, add ETA for downloads +* Simultaneous pulls now waits for the first to finish instead of failing +- Tag only the top-layer image when pushing to registry +- Fix issue with offline image transfer +- Fix issue preventing using ':' in password for registry + +#### Other + ++ Add pprof handler for debug ++ Create a Makefile +* Use stdlib tar that now includes fix +* Improve make.sh test script +* Handle SIGQUIT on the daemon +* Disable verbose during tests +* Upgrade to go1.2 for official build +* Improve unit tests +* The test suite now runs all tests even if one fails +* Refactor C in Go (Devmapper) +- Fix OSX compilation + ## 0.7.0 (2013-11-25) #### Notable features since 0.6.0 diff --git a/VERSION b/VERSION index e1bde8025c..39e898a4f9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.7.0-dev +0.7.1 From e01732f85769ac434e2614652aa25cd0ace7a4df Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 5 Dec 2013 19:03:47 -0700 Subject: [PATCH 4/8] Revert "Add cgroup-bin dependency to our Ubuntu package" This reverts commit c81bb20f5b2b5d86059c6004e60ba23b03d30fe0. After re-reading the documentation: "The Recommends field should list packages that would be found together with this one in all but unusual installations." Thus, "Recommends" is an acceptable place for this dep, and anyone disabling that gets to keep the pieces. The main crux of why this needs to be reverted is because it breaks Debian completely because "lxc" and "cgroup-bin" can't be installed concurrently. --- hack/make/ubuntu | 1 - 1 file changed, 1 deletion(-) diff --git a/hack/make/ubuntu b/hack/make/ubuntu index 258a869c24..578f254558 100644 --- a/hack/make/ubuntu +++ b/hack/make/ubuntu @@ -96,7 +96,6 @@ EOF --depends lxc \ --depends aufs-tools \ --depends iptables \ - --depends cgroup-bin \ --description "$PACKAGE_DESCRIPTION" \ --maintainer "$PACKAGE_MAINTAINER" \ --conflicts lxc-docker-virtual-package \ From 95c0ade04bb8fe95029fed521126e3268a1eda7f Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 6 Dec 2013 11:55:56 -0800 Subject: [PATCH 5/8] fix jsonmessage in build --- buildfile.go | 4 ++-- commands.go | 2 -- utils/jsonmessage.go | 7 +++++-- utils/streamformatter.go | 12 ++++++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/buildfile.go b/buildfile.go index 170d739ee4..adbf98d274 100644 --- a/buildfile.go +++ b/buildfile.go @@ -375,7 +375,7 @@ type StdoutFormater struct { } func (sf *StdoutFormater) Write(buf []byte) (int, error) { - formattedBuf := sf.StreamFormatter.FormatStatus("", "%s", string(buf)) + formattedBuf := sf.StreamFormatter.FormatStream(string(buf)) n, err := sf.Writer.Write(formattedBuf) if n != len(formattedBuf) { return n, io.ErrShortWrite @@ -389,7 +389,7 @@ type StderrFormater struct { } func (sf *StderrFormater) Write(buf []byte) (int, error) { - formattedBuf := sf.StreamFormatter.FormatStatus("", "%s", "\033[91m"+string(buf)+"\033[0m") + formattedBuf := sf.StreamFormatter.FormatStream("\033[91m" + string(buf) + "\033[0m") n, err := sf.Writer.Write(formattedBuf) if n != len(formattedBuf) { return n, io.ErrShortWrite diff --git a/commands.go b/commands.go index b7e7c08cac..48c0241b17 100644 --- a/commands.go +++ b/commands.go @@ -229,8 +229,6 @@ func (cli *DockerCli) CmdBuild(args ...string) error { if context != nil { headers.Set("Content-Type", "application/tar") } - // Temporary hack to fix displayJSON behavior - cli.isTerminal = false err = cli.stream("POST", fmt.Sprintf("/build?%s", v.Encode()), body, cli.out, headers) if jerr, ok := err.(*utils.JSONError); ok { return &utils.StatusError{Status: jerr.Message, StatusCode: jerr.Code} diff --git a/utils/jsonmessage.go b/utils/jsonmessage.go index c36ec27763..82fe631b49 100644 --- a/utils/jsonmessage.go +++ b/utils/jsonmessage.go @@ -66,6 +66,7 @@ func (p *JSONProgress) String() string { } type JSONMessage struct { + Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` ProgressMessage string `json:"progress,omitempty"` //deprecated @@ -87,7 +88,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { if isTerminal { // [2K = erase entire current line fmt.Fprintf(out, "%c[2K\r", 27) - endl = "\r\n" + endl = "\r" } if jm.Time != 0 { fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0)) @@ -102,8 +103,10 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl) } else if jm.ProgressMessage != "" { //deprecated fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl) + } else if jm.Stream != "" { + fmt.Fprintf(out, "%s%s", jm.Stream, endl) } else { - fmt.Fprintf(out, "%s%s", jm.Status, endl) + fmt.Fprintf(out, "%s%s\n", jm.Status, endl) } return nil } diff --git a/utils/streamformatter.go b/utils/streamformatter.go index 60863d2aa6..0c41d0bddd 100644 --- a/utils/streamformatter.go +++ b/utils/streamformatter.go @@ -14,6 +14,18 @@ func NewStreamFormatter(json bool) *StreamFormatter { return &StreamFormatter{json, false} } +func (sf *StreamFormatter) FormatStream(str string) []byte { + sf.used = true + if sf.json { + b, err := json.Marshal(&JSONMessage{Stream: str}) + if err != nil { + return sf.FormatError(err) + } + return b + } + return []byte(str + "\r") +} + func (sf *StreamFormatter) FormatStatus(id, format string, a ...interface{}) []byte { sf.used = true str := fmt.Sprintf(format, a...) From 0969be5ddb34ee8a6c09e882d13b1d655e028b23 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 6 Dec 2013 12:02:21 -0800 Subject: [PATCH 6/8] update doc --- docs/sources/api/docker_remote_api_v1.8.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/api/docker_remote_api_v1.8.rst b/docs/sources/api/docker_remote_api_v1.8.rst index 1e02817611..c9c2473d99 100644 --- a/docs/sources/api/docker_remote_api_v1.8.rst +++ b/docs/sources/api/docker_remote_api_v1.8.rst @@ -1008,8 +1008,8 @@ Build an image from Dockerfile via stdin HTTP/1.1 200 OK Content-Type: application/json - {"status":"Step 1..."} - {"status":"..."} + {"stream":"Step 1..."} + {"stream":"..."} {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}} From f28445254f42fd112aba5f2b67ae6169fae29c2b Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Fri, 6 Dec 2013 13:56:09 -0800 Subject: [PATCH 7/8] disable progressbar in non-terminal --- utils/jsonmessage.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/jsonmessage.go b/utils/jsonmessage.go index 82fe631b49..cc467162f9 100644 --- a/utils/jsonmessage.go +++ b/utils/jsonmessage.go @@ -89,6 +89,8 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { // [2K = erase entire current line fmt.Fprintf(out, "%c[2K\r", 27) endl = "\r" + } else if jm.Progress != nil { //disable progressbar in non-terminal + return nil } if jm.Time != 0 { fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0)) From 3c1f3be032be4cd4a8c9235ed35e3a269e5f524e Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 6 Dec 2013 17:31:09 -0800 Subject: [PATCH 8/8] Update version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 39e898a4f9..c0ab427224 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.7.1 +0.7.1-dev