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/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 { diff --git a/commands.go b/commands.go index fbe72b6e93..7df925124d 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. diff --git a/registry/registry.go b/registry/registry.go index cc5e7496b9..6f1446ef02 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -64,7 +64,11 @@ func (r *Registry) LookupRemoteImage(imgId, registry string, authConfig *auth.Au } req.SetBasicAuth(authConfig.Username, authConfig.Password) res, err := rt.RoundTrip(req) - return err == nil && res.StatusCode == 307 + if err != nil { + return false + } + res.Body.Close() + return res.StatusCode == 307 } func (r *Registry) getImagesInRepository(repository string, authConfig *auth.AuthConfig) ([]map[string]string, error) { @@ -152,16 +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) - 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 @@ -467,9 +474,15 @@ type Registry struct { } func NewRegistry(root string, authConfig *auth.AuthConfig) *Registry { + httpTransport := &http.Transport{ + DisableKeepAlives: true, + } + r := &Registry{ authConfig: authConfig, - client: &http.Client{}, + client: &http.Client{ + Transport: httpTransport, + }, } r.client.Jar = cookiejar.NewCookieJar() return r diff --git a/server.go b/server.go index 2a4b103654..6b26287341 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 }