From cb3c4af404e29e03e9971df62625cf9d90467ca6 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 22 Mar 2013 18:15:44 -0700 Subject: [PATCH 1/9] #141 Update and order the help --- commands.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/commands.go b/commands.go index 14ebe47b58..6193581cb2 100644 --- a/commands.go +++ b/commands.go @@ -30,14 +30,13 @@ func (srv *Server) Name() string { func (srv *Server) Help() string { help := "Usage: docker COMMAND [arg...]\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n" for _, cmd := range [][]interface{}{ - {"run", "Run a command in a container"}, - {"ps", "Display a list of containers"}, - {"import", "Create a new filesystem image from the contents of a tarball"}, {"attach", "Attach to a running container"}, {"commit", "Create a new image from a container's changes"}, - {"history", "Show the history of an image"}, {"diff", "Inspect changes on a container's filesystem"}, + {"export", "Stream the contents of a container as a tar archive"}, + {"history", "Show the history of an image"}, {"images", "List images"}, + {"import", "Create a new filesystem image from the contents of a tarball"}, {"info", "Display system-wide information"}, {"inspect", "Return low-level information on a container"}, {"kill", "Kill a running container"}, @@ -53,7 +52,7 @@ func (srv *Server) Help() string { {"run", "Run a command in a new container"}, {"start", "Start a stopped container"}, {"stop", "Stop a running container"}, - {"export", "Stream the contents of a container as a tar archive"}, + {"tag", "Tag an image into a repository"}, {"version", "Show the docker version information"}, {"wait", "Block until a container stops, then print its exit code"}, } { From df19863b23665daa056f5882676e6416e5a65e9e Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 22 Mar 2013 18:17:49 -0700 Subject: [PATCH 2/9] #142 Change the help for push and pull in order for it to be more clear --- commands.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 6193581cb2..a1472f4945 100644 --- a/commands.go +++ b/commands.go @@ -399,7 +399,7 @@ func (srv *Server) CmdImport(stdin io.ReadCloser, stdout io.Writer, args ...stri } func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string) error { - cmd := rcli.Subcmd(stdout, "push", "LOCAL", "Push an image or a repository to the registry") + cmd := rcli.Subcmd(stdout, "push", "NAME", "Push an image or a repository to the registry") if err := cmd.Parse(args); err != nil { return nil } @@ -459,7 +459,7 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string } func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string) error { - cmd := rcli.Subcmd(stdout, "pull", "IMAGE", "Pull an image or a repository from the registry") + cmd := rcli.Subcmd(stdout, "pull", "NAME", "Pull an image or a repository from the registry") if err := cmd.Parse(args); err != nil { return nil } From eb95e4915089c90dba8939c05825d2b5f5eed8e4 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 22 Mar 2013 19:04:12 -0700 Subject: [PATCH 3/9] #146 Auto login on push --- commands.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 4ca4f121b9..f3ddd4c65a 100644 --- a/commands.go +++ b/commands.go @@ -414,8 +414,13 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string } // If the login failed, abort - if srv.runtime.authConfig == nil { - return fmt.Errorf("Please login prior to push. ('docker login')") + if srv.runtime.authConfig == nil || srv.runtime.authConfig.Username == "" { + if err := srv.CmdLogin(stdin, stdout, args...); err != nil { + return err + } + if srv.runtime.authConfig == nil || srv.runtime.authConfig.Username == "" { + return fmt.Errorf("Please login prior to push. ('docker login')") + } } var remote string From 371225520fc86fa58fadd182730b958a0f7ef9ab Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Fri, 22 Mar 2013 21:43:31 -0700 Subject: [PATCH 4/9] handle errors during the creation of port mapper example: 2013/03/22 21:42:55 Unable to setup port networking: Failed to create DOCKER chain (which was possibly introduced by commit 3c6b8bb88) --- network.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/network.go b/network.go index 73cb1709af..6b913823c4 100644 --- a/network.go +++ b/network.go @@ -348,6 +348,9 @@ func newNetworkManager(bridgeIface string) (*NetworkManager, error) { } portMapper, err := newPortMapper() + if err != nil { + return nil, err + } manager := &NetworkManager{ bridgeIface: bridgeIface, From e09383bccfcefa3699aa959dedbd8364d505bf9c Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Sat, 23 Mar 2013 14:54:18 -0700 Subject: [PATCH 5/9] Remove json alteration --- registry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry.go b/registry.go index 8e14d48c1d..8076e3184c 100644 --- a/registry.go +++ b/registry.go @@ -32,7 +32,7 @@ func NewImgJson(src []byte) (*Image, error) { func NewMultipleImgJson(src []byte) ([]*Image, error) { ret := []*Image{} - dec := json.NewDecoder(strings.NewReader(strings.Replace(string(src), "null", "\"\"", -1))) + dec := json.NewDecoder(strings.NewReader(string(src))) for { m := &Image{} if err := dec.Decode(m); err == io.EOF { From 55c89087561e98eb2d4ce46b9d65c4e31f9297d8 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sun, 24 Mar 2013 14:13:08 -0700 Subject: [PATCH 6/9] `docker import` doesn't download an image ``` $ docker import base Downloading from http://base Error: Get http://base: lookup base: no such host ``` only `docker pull` does: ``` $ docker pull base Pulling base... Pulling repo: https://registry.docker.io/v1/users/base Pull completed ``` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 851ddb4fce..c955a1dcf2 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ Running an interactive shell ```bash # Download a base image -docker import base +docker pull base # Run an interactive shell in the base image, # allocate a tty, attach stdin and stdout From c61172f9c2e30ab70f512efdf699319da855f864 Mon Sep 17 00:00:00 2001 From: Mikhail Sobolev Date: Mon, 25 Mar 2013 01:36:59 +0200 Subject: [PATCH 7/9] fix run-time dependency --- deb/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb/debian/control b/deb/debian/control index 35a842df1e..5fd3f36f2d 100644 --- a/deb/debian/control +++ b/deb/debian/control @@ -10,7 +10,7 @@ Standards-Version: 3.9.2 Package: dotcloud-docker Architecture: amd64 Provides: dotcloud-docker -Depends: lxc, wget, bsdtar, curl, sqlite3 +Depends: lxc, wget, bsdtar, curl, libsqlite3-0 Conflicts: docker Description: A process manager with superpowers It encapsulates heterogeneous payloads in Standard Containers, and runs From 6576b19a28a688f00dbe21318b4073826001cf3c Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 25 Mar 2013 01:29:01 -0700 Subject: [PATCH 8/9] Improve the debug function --- utils.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/utils.go b/utils.go index ce722f264f..b9b230305f 100644 --- a/utils.go +++ b/utils.go @@ -7,11 +7,12 @@ import ( "fmt" "github.com/dotcloud/docker/rcli" "io" - "log" "net/http" "os" "os/exec" "path/filepath" + "runtime" + "strings" "sync" "time" ) @@ -43,9 +44,19 @@ func Download(url string, stderr io.Writer) (*http.Response, error) { // If Docker is in damon mode, also send the debug info on the socket func Debugf(format string, a ...interface{}) { if rcli.DEBUG_FLAG { - log.Printf(format, a...) + + // Retrieve the stack infos + _, file, line, ok := runtime.Caller(1) + if !ok { + file = "" + line = -1 + } else { + file = file[strings.LastIndex(file, "/")+1:] + } + + fmt.Fprintf(os.Stderr, fmt.Sprintf("[debug] %s:%d %s\n", file, line, format), a...) if rcli.CLIENT_SOCKET != nil { - fmt.Fprintf(rcli.CLIENT_SOCKET, log.Prefix()+format, a...) + fmt.Fprintf(rcli.CLIENT_SOCKET, fmt.Sprintf("[debug] %s:%d %s\n", file, line, format), a...) } } } From c8ca50b48328448d70c3f227dc7bb8d65a980f6b Mon Sep 17 00:00:00 2001 From: shin- Date: Mon, 25 Mar 2013 07:17:11 -0700 Subject: [PATCH 9/9] Fixed issue #158 (docker crashes when docker run is called with not enough arguments) --- container.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/container.go b/container.go index f900599d00..2a7d633bc0 100644 --- a/container.go +++ b/container.go @@ -76,6 +76,15 @@ func ParseRun(args []string) (*Config, error) { if err := cmd.Parse(args); err != nil { return nil, err } + parsedArgs := cmd.Args() + runCmd := []string{} + image := "" + if len(parsedArgs) >= 1 { + image = cmd.Arg(0) + } + if len(parsedArgs) > 1 { + runCmd = parsedArgs[1:] + } config := &Config{ Ports: fl_ports, User: *fl_user, @@ -84,8 +93,8 @@ func ParseRun(args []string) (*Config, error) { Memory: *fl_memory, Detach: *fl_detach, Env: fl_env, - Cmd: cmd.Args()[1:], - Image: cmd.Arg(0), + Cmd: runCmd, + Image: image, } return config, nil }