From 854039b6ba9c707af07f9966b39150ce23150920 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Mon, 3 Jun 2013 17:25:51 +0000 Subject: [PATCH 1/5] remove TrimLeft as it's go1.1 --- changes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes.go b/changes.go index e50b88758a..dc1b015726 100644 --- a/changes.go +++ b/changes.go @@ -65,7 +65,7 @@ func Changes(layers []string, rw string) ([]Change, error) { file := filepath.Base(path) // If there is a whiteout, then the file was removed if strings.HasPrefix(file, ".wh.") { - originalFile := strings.TrimPrefix(file, ".wh.") + originalFile := file[len(".wh."):] change.Path = filepath.Join(filepath.Dir(path), originalFile) change.Kind = ChangeDelete } else { From a8ae398bf52e97148ee7bd0d5868de2e15bd297f Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Mon, 3 Jun 2013 10:59:48 -0700 Subject: [PATCH 2/5] Bumped version to 0.4.0 --- CHANGELOG.md | 5 +++++ commands.go | 2 +- packaging/ubuntu/changelog | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8464b5345..44e52eecb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.4.0 (2013-06-03) + + Introducing Builder: 'docker build' builds a container, layer by layer, from a source repository containing a Dockerfile + + Introducing Remote API: control Docker programmatically using a simple HTTP/json API + * Runtime: various reliability and usability improvements + ## 0.3.4 (2013-05-30) + Builder: 'docker build' builds a container, layer by layer, from a source repository containing a Dockerfile + Builder: 'docker build -t FOO' applies the tag FOO to the newly built container. diff --git a/commands.go b/commands.go index ddb2c1a52b..c38c18a04c 100644 --- a/commands.go +++ b/commands.go @@ -28,7 +28,7 @@ import ( "unicode" ) -const VERSION = "0.3.4" +const VERSION = "0.4.0" var ( GIT_COMMIT string diff --git a/packaging/ubuntu/changelog b/packaging/ubuntu/changelog index 10151ed483..5fc2e49d5e 100644 --- a/packaging/ubuntu/changelog +++ b/packaging/ubuntu/changelog @@ -1,3 +1,10 @@ +lxc-docker (0.4.0-1) precise; urgency=low + - Introducing Builder: 'docker build' builds a container, layer by layer, from a source repository containing a Dockerfile + - Introducing Remote API: control Docker programmatically using a simple HTTP/json API + - Runtime: various reliability and usability improvements + + -- dotCloud Mon, 03 Jun 2013 00:00:00 -0700 + lxc-docker (0.3.4-1) precise; urgency=low - Builder: 'docker build' builds a container, layer by layer, from a source repository containing a Dockerfile - Builder: 'docker build -t FOO' applies the tag FOO to the newly built container. From 830c458fe761aca5ad2facec33b3d0798caab116 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Mon, 3 Jun 2013 12:14:57 -0700 Subject: [PATCH 3/5] Fixed missing Body.Close when doing some HTTP requests. It should improve some request issues. --- registry/registry.go | 7 ++++++- server.go | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/registry/registry.go b/registry/registry.go index 36b01d643a..d9f53ee9f9 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -64,6 +64,9 @@ func (r *Registry) LookupRemoteImage(imgId, registry string, authConfig *auth.Au } req.SetBasicAuth(authConfig.Username, authConfig.Password) res, err := rt.RoundTrip(req) + if err == nil { + defer res.Body.Close() + } return err == nil && res.StatusCode == 307 } @@ -152,7 +155,9 @@ func (r *Registry) GetRemoteTags(registries []string, repository string, token [ } req.Header.Set("Authorization", "Token "+strings.Join(token, ", ")) res, err := r.client.Do(req) - defer res.Body.Close() + if err == nil { + defer res.Body.Close() + } utils.Debugf("Got status code %d from %s", res.StatusCode, endpoint) if err != nil || (res.StatusCode != 200 && res.StatusCode != 404) { continue diff --git a/server.go b/server.go index fa847b9ce5..08cb37a72e 100644 --- a/server.go +++ b/server.go @@ -321,6 +321,7 @@ func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgId, endpoin if err != nil { return err } + defer layer.Close() if err := srv.runtime.graph.Register(utils.ProgressReader(layer, contentLength, out, sf.FormatProgress("Downloading", "%v/%v (%v)"), sf), false, img); err != nil { return err } From 82dd963e08778f8c563e058f1b19ccc358965615 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 3 Jun 2013 12:20:52 -0700 Subject: [PATCH 4/5] Minor changes in registry.go --- registry/registry.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/registry/registry.go b/registry/registry.go index d9f53ee9f9..8283bf4437 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -64,10 +64,11 @@ func (r *Registry) LookupRemoteImage(imgId, registry string, authConfig *auth.Au } req.SetBasicAuth(authConfig.Username, authConfig.Password) res, err := rt.RoundTrip(req) - if err == nil { - defer res.Body.Close() + if err != nil { + return false } - return err == nil && res.StatusCode == 307 + res.Body.Close() + return res.StatusCode == 307 } func (r *Registry) getImagesInRepository(repository string, authConfig *auth.AuthConfig) ([]map[string]string, error) { @@ -155,18 +156,19 @@ func (r *Registry) GetRemoteTags(registries []string, repository string, token [ } req.Header.Set("Authorization", "Token "+strings.Join(token, ", ")) res, err := r.client.Do(req) - if err == nil { - defer res.Body.Close() - } utils.Debugf("Got status code %d from %s", res.StatusCode, endpoint) - if err != nil || (res.StatusCode != 200 && res.StatusCode != 404) { + if err != nil { + return nil, err + } + defer res.Body.Close() + + if res.StatusCode != 200 && res.StatusCode != 404 { continue } else if res.StatusCode == 404 { return nil, fmt.Errorf("Repository not found") } result := make(map[string]string) - rawJson, err := ioutil.ReadAll(res.Body) if err != nil { return nil, err From cff3b37a61b8da883437eec799b7b852d22538f0 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Mon, 3 Jun 2013 14:42:21 -0700 Subject: [PATCH 5/5] Disabled HTTP keep-alive in the default HTTP client for Registry calls --- registry/registry.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/registry/registry.go b/registry/registry.go index 8283bf4437..aeae3fe4a4 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -477,9 +477,15 @@ func NewRegistry(root string) *Registry { // If the auth file does not exist, keep going authConfig, _ := auth.LoadConfig(root) + httpTransport := &http.Transport{ + DisableKeepAlives: true, + } + r := &Registry{ authConfig: authConfig, - client: &http.Client{}, + client: &http.Client{ + Transport: httpTransport, + }, } r.client.Jar = cookiejar.NewCookieJar() return r