From b22c9731102abbaf42e8d7e37e179ef56b945ccd Mon Sep 17 00:00:00 2001 From: Song Gao Date: Sun, 18 Aug 2013 21:44:46 -0500 Subject: [PATCH 1/9] Added escape sequence to tutorial --- docs/sources/use/basics.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/sources/use/basics.rst b/docs/sources/use/basics.rst index 411e1c30d1..b4f93b432b 100644 --- a/docs/sources/use/basics.rst +++ b/docs/sources/use/basics.rst @@ -33,6 +33,8 @@ Running an interactive shell # Run an interactive shell in the ubuntu image, # allocate a tty, attach stdin and stdout + # To detach the tty without exiting the shell, + # use the escape sequence Ctrl-p + Ctrl-q sudo docker run -i -t ubuntu /bin/bash Why ``sudo``? From 3396a183c61b66dd60458f67049a50b393e760f8 Mon Sep 17 00:00:00 2001 From: Abhiraj Butala Date: Fri, 23 Aug 2013 01:28:58 -0700 Subject: [PATCH 2/9] Update docker_remote_api.rst --- docs/sources/api/docker_remote_api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/api/docker_remote_api.rst b/docs/sources/api/docker_remote_api.rst index 17fe3b82e3..82db83d507 100644 --- a/docs/sources/api/docker_remote_api.rst +++ b/docs/sources/api/docker_remote_api.rst @@ -165,7 +165,7 @@ Initial version Docker Remote API Client Libraries ================================== -These libraries have been not tested by the Docker Maintainers for +These libraries have not been tested by the Docker Maintainers for compatibility. Please file issues with the library owners. If you find more library implementations, please list them in Docker doc bugs and we will add the libraries here. From 3d9b4379a5b84e52a04b31129f87fd0eef3cf54d Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 23 Aug 2013 20:01:08 +0000 Subject: [PATCH 3/9] Use correct upstart script with new build tool --- hack/release/make.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hack/release/make.sh b/hack/release/make.sh index a9395832bf..7792297861 100755 --- a/hack/release/make.sh +++ b/hack/release/make.sh @@ -57,7 +57,9 @@ stop on runlevel [!2345] respawn -exec docker -d +script + /usr/bin/docker -d +end script ' # Each "bundle" is a different type of build artefact: static binary, Ubuntu From 5a8c32dc8e3f7a8980b2b7feeed0a2ba5ec027c2 Mon Sep 17 00:00:00 2001 From: shin- Date: Thu, 22 Aug 2013 21:15:31 +0200 Subject: [PATCH 4/9] Use additional decorator in RequestFactory to pass meta headers to registry --- api.go | 18 +++++++++++++++--- buildfile.go | 2 +- server.go | 17 ++++++++++------- utils/http.go | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/api.go b/api.go index 41edc4f4c5..9e094231b5 100644 --- a/api.go +++ b/api.go @@ -101,7 +101,7 @@ func postAuth(srv *Server, version float64, w http.ResponseWriter, r *http.Reque if err != nil { return err } - status, err := auth.Login(authConfig, srv.HTTPRequestFactory()) + status, err := auth.Login(authConfig, srv.HTTPRequestFactory(nil)) if err != nil { return err } @@ -399,7 +399,13 @@ func postImagesCreate(srv *Server, version float64, w http.ResponseWriter, r *ht } sf := utils.NewStreamFormatter(version > 1.0) if image != "" { //pull - if err := srv.ImagePull(image, tag, w, sf, &auth.AuthConfig{}, version > 1.3); err != nil { + metaHeaders := map[string][]string{} + for k, v := range r.Header { + if strings.HasPrefix(k, "X-Meta-") { + metaHeaders[k] = v + } + } + if err := srv.ImagePull(image, tag, w, sf, &auth.AuthConfig{}, metaHeaders, version > 1.3); err != nil { if sf.Used() { w.Write(sf.FormatError(err)) return nil @@ -468,6 +474,12 @@ func postImagesInsert(srv *Server, version float64, w http.ResponseWriter, r *ht func postImagesPush(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { authConfig := &auth.AuthConfig{} + metaHeaders := map[string][]string{} + for k, v := range r.Header { + if strings.HasPrefix(k, "X-Meta-") { + metaHeaders[k] = v + } + } if err := json.NewDecoder(r.Body).Decode(authConfig); err != nil { return err } @@ -483,7 +495,7 @@ func postImagesPush(srv *Server, version float64, w http.ResponseWriter, r *http w.Header().Set("Content-Type", "application/json") } sf := utils.NewStreamFormatter(version > 1.0) - if err := srv.ImagePush(name, w, sf, authConfig); err != nil { + if err := srv.ImagePush(name, w, sf, authConfig, metaHeaders); err != nil { if sf.Used() { w.Write(sf.FormatError(err)) return nil diff --git a/buildfile.go b/buildfile.go index 64c4503c9a..4c8db2c60e 100644 --- a/buildfile.go +++ b/buildfile.go @@ -56,7 +56,7 @@ func (b *buildFile) CmdFrom(name string) error { if err != nil { if b.runtime.graph.IsNotExist(err) { remote, tag := utils.ParseRepositoryTag(name) - if err := b.srv.ImagePull(remote, tag, b.out, utils.NewStreamFormatter(false), nil, true); err != nil { + if err := b.srv.ImagePull(remote, tag, b.out, utils.NewStreamFormatter(false), nil, nil, true); err != nil { return err } image, err = b.runtime.repositories.LookupImage(name) diff --git a/server.go b/server.go index fc41424827..646cb44877 100644 --- a/server.go +++ b/server.go @@ -102,7 +102,7 @@ func (srv *Server) ContainerExport(name string, out io.Writer) error { } func (srv *Server) ImagesSearch(term string) ([]APISearch, error) { - r, err := registry.NewRegistry(srv.runtime.root, nil, srv.HTTPRequestFactory()) + r, err := registry.NewRegistry(srv.runtime.root, nil, srv.HTTPRequestFactory(nil)) if err != nil { return nil, err } @@ -632,8 +632,8 @@ func (srv *Server) poolRemove(kind, key string) error { return nil } -func (srv *Server) ImagePull(localName string, tag string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig, parallel bool) error { - r, err := registry.NewRegistry(srv.runtime.root, authConfig, srv.HTTPRequestFactory()) +func (srv *Server) ImagePull(localName string, tag string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig, metaHeaders map[string][]string, parallel bool) error { + r, err := registry.NewRegistry(srv.runtime.root, authConfig, srv.HTTPRequestFactory(metaHeaders)) if err != nil { return err } @@ -780,7 +780,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgID, } // FIXME: Allow to interrupt current push when new push of same image is done. -func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig) error { +func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig, metaHeaders map[string][]string) error { if err := srv.poolAdd("push", localName); err != nil { return err } @@ -794,7 +794,7 @@ func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFo out = utils.NewWriteFlusher(out) img, err := srv.runtime.graph.Get(localName) - r, err2 := registry.NewRegistry(srv.runtime.root, authConfig, srv.HTTPRequestFactory()) + r, err2 := registry.NewRegistry(srv.runtime.root, authConfig, srv.HTTPRequestFactory(metaHeaders)) if err2 != nil { return err2 } @@ -1267,10 +1267,13 @@ func NewServer(flGraphPath string, autoRestart, enableCors bool, dns ListOpts) ( return srv, nil } -func (srv *Server) HTTPRequestFactory() *utils.HTTPRequestFactory { +func (srv *Server) HTTPRequestFactory(metaHeaders map[string][]string) *utils.HTTPRequestFactory { if srv.reqFactory == nil { ud := utils.NewHTTPUserAgentDecorator(srv.versionInfos()...) - factory := utils.NewHTTPRequestFactory(ud) + md := &utils.HTTPMetaHeadersDecorator{ + Headers: metaHeaders, + } + factory := utils.NewHTTPRequestFactory(ud, md) srv.reqFactory = factory } return srv.reqFactory diff --git a/utils/http.go b/utils/http.go index 8c1e4b7a79..1332ce816d 100644 --- a/utils/http.go +++ b/utils/http.go @@ -93,6 +93,20 @@ func (self *HTTPUserAgentDecorator) ChangeRequest(req *http.Request) (newReq *ht return req, nil } +type HTTPMetaHeadersDecorator struct { + Headers map[string][]string +} + +func (self *HTTPMetaHeadersDecorator) ChangeRequest(req *http.Request) (newReq *http.Request, err error) { + if self.Headers == nil { + return req, nil + } + for k, v := range self.Headers { + req.Header[k] = v + } + return req, nil +} + // HTTPRequestFactory creates an HTTP request // and applies a list of decorators on the request. type HTTPRequestFactory struct { From 29be20f987a7a7bb8aeb89bd15ae31840b0b5df5 Mon Sep 17 00:00:00 2001 From: shin- Date: Fri, 23 Aug 2013 04:32:09 +0200 Subject: [PATCH 5/9] Fixed: ImagePull in runtime test --- runtime_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime_test.go b/runtime_test.go index 8819df2221..83ada6dd21 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -101,7 +101,7 @@ func init() { // If the unit test is not found, try to download it. if img, err := globalRuntime.repositories.LookupImage(unitTestImageName); err != nil || img.ID != unitTestImageID { // Retrieve the Image - if err := srv.ImagePull(unitTestImageName, "", os.Stdout, utils.NewStreamFormatter(false), nil, true); err != nil { + if err := srv.ImagePull(unitTestImageName, "", os.Stdout, utils.NewStreamFormatter(false), nil, nil, true); err != nil { panic(err) } } From 59281d6f805a7f569af6bdb509fe3257fef05156 Mon Sep 17 00:00:00 2001 From: unclejack Date: Fri, 23 Aug 2013 19:13:30 +0300 Subject: [PATCH 6/9] use libffi-dev, don't build it from sources --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 08019070b3..2cc749ac9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ env GOPATH /go env CGO_ENABLED 0 run cd /tmp && echo 'package main' > t.go && go test -a -i -v # Ubuntu stuff -run apt-get install -y -q ruby1.9.3 rubygems +run apt-get install -y -q ruby1.9.3 rubygems libffi-dev run gem install fpm run apt-get install -y -q reprepro dpkg-sig # Install s3cmd 1.0.1 (earlier versions don't support env variables in the config) From 15d658d36bcc8bc9226be87a01a3ab7cc7e4ac6f Mon Sep 17 00:00:00 2001 From: Kawsar Saiyeed Date: Thu, 22 Aug 2013 23:12:28 +0100 Subject: [PATCH 7/9] Removed duplicate mercurial install command --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2cc749ac9b..8694f07c37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,8 +28,6 @@ run PKG=github.com/kr/pty REV=27435c699; git clone http://$PKG /go/src/$PKG && run PKG=github.com/gorilla/context/ REV=708054d61e5; git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV run PKG=github.com/gorilla/mux/ REV=9b36453141c; git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV run PKG=github.com/dotcloud/tar/ REV=d06045a6d9; git clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && git checkout -f $REV -# Docker requires code.google.com/p/go.net/websocket -run apt-get install -y -q mercurial run PKG=code.google.com/p/go.net/ REV=84a4013f96e0; hg clone http://$PKG /go/src/$PKG && cd /go/src/$PKG && hg checkout $REV # Upload docker source add . /go/src/github.com/dotcloud/docker From 7b5c579b7744877af02777a82aa8c7b28cfc1172 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 23 Aug 2013 20:01:08 +0000 Subject: [PATCH 8/9] Use correct upstart script with new build tool --- hack/release/make.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hack/release/make.sh b/hack/release/make.sh index a9395832bf..7792297861 100755 --- a/hack/release/make.sh +++ b/hack/release/make.sh @@ -57,7 +57,9 @@ stop on runlevel [!2345] respawn -exec docker -d +script + /usr/bin/docker -d +end script ' # Each "bundle" is a different type of build artefact: static binary, Ubuntu From 5105263dacc9372771d9bf478dcac6fceedb9a30 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 23 Aug 2013 22:23:30 +0000 Subject: [PATCH 9/9] Bump to v0.6.1 --- CHANGELOG.md | 6 ++++++ VERSION | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4b4d9e9e0..968c6696f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.6.1 (2013-08-23) +* Registry: Pass "meta" headers in API calls to the registry +- Packaging: Use correct upstart script with new build tool +- Packaging: Use libffi-dev, don't build it from sources +- Packaging: Removed duplicate mercurial install command + ## 0.6.0 (2013-08-22) - Runtime: Load authConfig only when needed and fix useless WARNING + Runtime: Add lxc-conf flag to allow custom lxc options diff --git a/VERSION b/VERSION index a918a2aa18..ee6cdce3c2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.0 +0.6.1