From 45436942afeb7354a997f12c7fb0cb1f520390ae Mon Sep 17 00:00:00 2001 From: Ken Cochrane Date: Mon, 25 Mar 2013 21:33:56 -0400 Subject: [PATCH 01/16] fixed an issue with the help history command, printed twice Upstream-commit: a9a439183da194b0039bae7f0f4d9531c4849f88 Component: engine --- components/engine/commands.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index a0a322afab..2b59952920 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -297,7 +297,10 @@ func (srv *Server) CmdRmi(stdin io.ReadCloser, stdout io.Writer, args ...string) func (srv *Server) CmdHistory(stdin io.ReadCloser, stdout io.Writer, args ...string) error { cmd := rcli.Subcmd(stdout, "history", "[OPTIONS] IMAGE", "Show the history of an image") - if cmd.Parse(args) != nil || cmd.NArg() != 1 { + if err := cmd.Parse(args); err != nil { + return nil + } + if cmd.NArg() != 1 { cmd.Usage() return nil } From 2a4596d92bcc1047ea7017b24016c8920d7e0c16 Mon Sep 17 00:00:00 2001 From: Ken Cochrane Date: Mon, 25 Mar 2013 21:35:31 -0400 Subject: [PATCH 02/16] fixed issue with rmi help showing help twice Upstream-commit: c9d93cd333b7f14782f3abbc53c7dd09fd5880dd Component: engine --- components/engine/commands.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index 2b59952920..483d113185 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -283,7 +283,10 @@ func (srv *Server) CmdPort(stdin io.ReadCloser, stdout io.Writer, args ...string // 'docker rmi NAME' removes all images with the name NAME func (srv *Server) CmdRmi(stdin io.ReadCloser, stdout io.Writer, args ...string) (err error) { cmd := rcli.Subcmd(stdout, "rmimage", "[OPTIONS] IMAGE", "Remove an image") - if cmd.Parse(args) != nil || cmd.NArg() < 1 { + if err := cmd.Parse(args); err != nil { + return nil + } + if cmd.NArg() < 1 { cmd.Usage() return nil } From a6264acfa711e658c6ae914b81f06ecf9c05c51f Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 25 Mar 2013 18:43:25 -0700 Subject: [PATCH 03/16] Fix termcaps on the linux client Upstream-commit: 922a8648fc5724ad3ff38e2404d70442dc8f2264 Component: engine --- components/engine/container.go | 3 ++ components/engine/term/termios_linux.go | 62 ++++++++++++++++++------- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/components/engine/container.go b/components/engine/container.go index 7e7077c123..7693f85a98 100644 --- a/components/engine/container.go +++ b/components/engine/container.go @@ -255,6 +255,9 @@ func (container *Container) Start() error { var err error if container.Config.Tty { + container.cmd.Env = append(container.Config.Env, + "TERM="+os.Getenv("TERM"), + ) err = container.startPty() } else { err = container.start() diff --git a/components/engine/term/termios_linux.go b/components/engine/term/termios_linux.go index 933ef84c4d..f018a58e63 100644 --- a/components/engine/term/termios_linux.go +++ b/components/engine/term/termios_linux.go @@ -1,10 +1,31 @@ package term import ( - "syscall" - "unsafe" + "os" + "syscall" + "unsafe" ) +// #include +// #include +/* +void MakeRaw() { + struct termios t; + + // FIXME: Handle errors? + ioctl(0, TCGETS, &t); + + t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); + t.c_oflag &= ~OPOST; + t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + t.c_cflag &= ~(CSIZE | PARENB); + t.c_cflag |= CS8; + + ioctl(0, TCSETS, &t); +} +*/ +import "C" + const ( getTermios = syscall.TCGETS setTermios = syscall.TCSETS @@ -14,19 +35,28 @@ const ( // mode and returns the previous state of the terminal so that it can be // restored. func MakeRaw(fd int) (*State, error) { - var oldState State - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(getTermios), uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { - return nil, err - } - newState := oldState.termios - newState.Iflag &^= ISTRIP | IXON | IXOFF - newState.Iflag |= ICRNL - newState.Oflag |= ONLCR - newState.Lflag &^= ECHO | ICANON | ISIG - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(setTermios), uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { - return nil, err - } + fd = int(os.Stdin.Fd()) - return &oldState, nil -} \ No newline at end of file + var oldState State + if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TCGETS, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { + return nil, err + } + C.MakeRaw() + return &oldState, nil + + // FIXME: post on goland issues this: very same as the C function bug non-working + + // newState := oldState.termios + + // newState.Iflag &^= (IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON) + // newState.Oflag &^= OPOST + // newState.Lflag &^= (ECHO | syscall.ECHONL | ICANON | ISIG | IEXTEN) + // newState.Cflag &^= (CSIZE | syscall.PARENB) + // newState.Cflag |= CS8 + + // if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), syscall.TCSETS, uintptr(unsafe.Pointer(&newState))); err != 0 { + // return nil, err + // } + // return &oldState, nil +} From 817a5a63f10670ab5347620e884d8f8f04257761 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 25 Mar 2013 18:43:25 -0700 Subject: [PATCH 04/16] Fix termcaps on the linux client Upstream-commit: 50bee2f8114ce562d63b08665f7371aa5a568b2c Component: engine --- components/engine/container.go | 3 ++ components/engine/term/termios_linux.go | 62 ++++++++++++++++++------- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/components/engine/container.go b/components/engine/container.go index 7e7077c123..7693f85a98 100644 --- a/components/engine/container.go +++ b/components/engine/container.go @@ -255,6 +255,9 @@ func (container *Container) Start() error { var err error if container.Config.Tty { + container.cmd.Env = append(container.Config.Env, + "TERM="+os.Getenv("TERM"), + ) err = container.startPty() } else { err = container.start() diff --git a/components/engine/term/termios_linux.go b/components/engine/term/termios_linux.go index 933ef84c4d..f018a58e63 100644 --- a/components/engine/term/termios_linux.go +++ b/components/engine/term/termios_linux.go @@ -1,10 +1,31 @@ package term import ( - "syscall" - "unsafe" + "os" + "syscall" + "unsafe" ) +// #include +// #include +/* +void MakeRaw() { + struct termios t; + + // FIXME: Handle errors? + ioctl(0, TCGETS, &t); + + t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); + t.c_oflag &= ~OPOST; + t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + t.c_cflag &= ~(CSIZE | PARENB); + t.c_cflag |= CS8; + + ioctl(0, TCSETS, &t); +} +*/ +import "C" + const ( getTermios = syscall.TCGETS setTermios = syscall.TCSETS @@ -14,19 +35,28 @@ const ( // mode and returns the previous state of the terminal so that it can be // restored. func MakeRaw(fd int) (*State, error) { - var oldState State - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(getTermios), uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { - return nil, err - } - newState := oldState.termios - newState.Iflag &^= ISTRIP | IXON | IXOFF - newState.Iflag |= ICRNL - newState.Oflag |= ONLCR - newState.Lflag &^= ECHO | ICANON | ISIG - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(setTermios), uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { - return nil, err - } + fd = int(os.Stdin.Fd()) - return &oldState, nil -} \ No newline at end of file + var oldState State + if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TCGETS, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { + return nil, err + } + C.MakeRaw() + return &oldState, nil + + // FIXME: post on goland issues this: very same as the C function bug non-working + + // newState := oldState.termios + + // newState.Iflag &^= (IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON) + // newState.Oflag &^= OPOST + // newState.Lflag &^= (ECHO | syscall.ECHONL | ICANON | ISIG | IEXTEN) + // newState.Cflag &^= (CSIZE | syscall.PARENB) + // newState.Cflag |= CS8 + + // if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), syscall.TCSETS, uintptr(unsafe.Pointer(&newState))); err != 0 { + // return nil, err + // } + // return &oldState, nil +} From 8cb6c1c0a25fa6b0ea9534f6c59bbf481a5902b0 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Mon, 25 Mar 2013 18:48:57 -0700 Subject: [PATCH 05/16] Cleaned up error checking of 'docker pull', to be symmetrical to 'docker push' Upstream-commit: f70bc2c98ca743e61ffd5b4c7d6590c8fd6a31ae Component: engine --- components/engine/commands.go | 6 +----- components/engine/registry.go | 40 ++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index a0a322afab..626c9dd47f 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -472,19 +472,15 @@ func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string } if srv.runtime.graph.LookupRemoteImage(remote, srv.runtime.authConfig) { - fmt.Fprintf(stdout, "Pulling %s...\n", remote) - if err := srv.runtime.graph.PullImage(remote, srv.runtime.authConfig); err != nil { + if err := srv.runtime.graph.PullImage(stdout, remote, srv.runtime.authConfig); err != nil { return err } - fmt.Fprintf(stdout, "Pulled\n") return nil } // FIXME: Allow pull repo:tag - fmt.Fprintf(stdout, "Pulling %s...\n", remote) if err := srv.runtime.graph.PullRepository(stdout, remote, "", srv.runtime.repositories, srv.runtime.authConfig); err != nil { return err } - fmt.Fprintf(stdout, "Pull completed\n") return nil } diff --git a/components/engine/registry.go b/components/engine/registry.go index ea4751bbbe..fd8db708d1 100644 --- a/components/engine/registry.go +++ b/components/engine/registry.go @@ -94,36 +94,38 @@ func (graph *Graph) LookupRemoteImage(imgId string, authConfig *auth.AuthConfig) // Retrieve an image from the Registry. // Returns the Image object as well as the layer as an Archive (io.Reader) -func (graph *Graph) getRemoteImage(imgId string, authConfig *auth.AuthConfig) (*Image, Archive, error) { +func (graph *Graph) getRemoteImage(stdout io.Writer, imgId string, authConfig *auth.AuthConfig) (*Image, Archive, error) { client := &http.Client{} + fmt.Fprintf(stdout, "Pulling %s metadata\n", imgId) // Get the Json req, err := http.NewRequest("GET", REGISTRY_ENDPOINT+"/images/"+imgId+"/json", nil) if err != nil { - return nil, nil, fmt.Errorf("Error while getting from the server: %s\n", err) + return nil, nil, fmt.Errorf("Failed to download json: %s", err) } req.SetBasicAuth(authConfig.Username, authConfig.Password) res, err := client.Do(req) - if err != nil || res.StatusCode != 200 { - if res != nil { - return nil, nil, fmt.Errorf("Internal server error: %d trying to get image %s", res.StatusCode, imgId) - } - return nil, nil, err + if err != nil { + return nil, nil, fmt.Errorf("Failed to download json: %s", err) + } + if res.StatusCode != 200 { + return nil, nil, fmt.Errorf("HTTP code %d", res.StatusCode) } defer res.Body.Close() jsonString, err := ioutil.ReadAll(res.Body) if err != nil { - return nil, nil, fmt.Errorf("Error while reading the http response: %s\n", err) + return nil, nil, fmt.Errorf("Failed to download json: %s", err) } img, err := NewImgJson(jsonString) if err != nil { - return nil, nil, fmt.Errorf("Error while parsing the json: %s\n", err) + return nil, nil, fmt.Errorf("Failed to parse json: %s", err) } img.Id = imgId // Get the layer + fmt.Fprintf(stdout, "Pulling %s fs layer\n", imgId) req, err = http.NewRequest("GET", REGISTRY_ENDPOINT+"/images/"+imgId+"/layer", nil) if err != nil { return nil, nil, fmt.Errorf("Error while getting from the server: %s\n", err) @@ -136,7 +138,7 @@ func (graph *Graph) getRemoteImage(imgId string, authConfig *auth.AuthConfig) (* return img, res.Body, nil } -func (graph *Graph) PullImage(imgId string, authConfig *auth.AuthConfig) error { +func (graph *Graph) PullImage(stdout io.Writer, imgId string, authConfig *auth.AuthConfig) error { history, err := graph.getRemoteHistory(imgId, authConfig) if err != nil { return err @@ -145,7 +147,7 @@ func (graph *Graph) PullImage(imgId string, authConfig *auth.AuthConfig) error { // FIXME: Lunch the getRemoteImage() in goroutines for _, j := range history { if !graph.Exists(j.Id) { - img, layer, err := graph.getRemoteImage(j.Id, authConfig) + img, layer, err := graph.getRemoteImage(stdout, j.Id, authConfig) if err != nil { // FIXME: Keep goging in case of error? return err @@ -162,7 +164,7 @@ func (graph *Graph) PullImage(imgId string, authConfig *auth.AuthConfig) error { func (graph *Graph) PullRepository(stdout io.Writer, remote, askedTag string, repositories *TagStore, authConfig *auth.AuthConfig) error { client := &http.Client{} - fmt.Fprintf(stdout, "Pulling repo: %s\n", REGISTRY_ENDPOINT+"/users/"+remote) + fmt.Fprintf(stdout, "Pulling repository %s\n", remote) var repositoryTarget string // If we are asking for 'root' repository, lookup on the Library's registry @@ -178,12 +180,12 @@ func (graph *Graph) PullRepository(stdout io.Writer, remote, askedTag string, re } req.SetBasicAuth(authConfig.Username, authConfig.Password) res, err := client.Do(req) - if err != nil || res.StatusCode != 200 { - if res != nil { - return fmt.Errorf("Internal server error: %d trying to pull %s", res.StatusCode, remote) - } + if err != nil { return err } + if res.StatusCode != 200 { + return fmt.Errorf("HTTP code: %d", res.StatusCode) + } defer res.Body.Close() rawJson, err := ioutil.ReadAll(res.Body) if err != nil { @@ -194,7 +196,8 @@ func (graph *Graph) PullRepository(stdout io.Writer, remote, askedTag string, re return err } for tag, rev := range t { - if err = graph.PullImage(rev, authConfig); err != nil { + fmt.Fprintf(stdout, "Pulling tag %s:%s\n", remote, tag) + if err = graph.PullImage(stdout, rev, authConfig); err != nil { return err } if err = repositories.Set(remote, tag, rev, true); err != nil { @@ -232,10 +235,9 @@ func (graph *Graph) PushImage(stdout io.Writer, imgOrig *Image, authConfig *auth req.SetBasicAuth(authConfig.Username, authConfig.Password) res, err := client.Do(req) if err != nil { - return fmt.Errorf("Failed to upload json: %s", err) + return fmt.Errorf("Failed to upload metadata: %s", err) } if res.StatusCode != 200 { - Debugf("Pushing return status: %d\n", res.StatusCode) switch res.StatusCode { case 204: // Case where the image is already on the Registry From 3eab201e1b1bba395a87de8f6fbb966b3a54ae8d Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Mon, 25 Mar 2013 18:50:02 -0700 Subject: [PATCH 06/16] Improved error checking of 'docker pull' by printing body of HTTP error Upstream-commit: 7943a02cb65dd40f7b3c3c4cb9a01a8caced231e Component: engine --- components/engine/registry.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/engine/registry.go b/components/engine/registry.go index fd8db708d1..c7dd23b850 100644 --- a/components/engine/registry.go +++ b/components/engine/registry.go @@ -244,7 +244,11 @@ func (graph *Graph) PushImage(stdout io.Writer, imgOrig *Image, authConfig *auth // FIXME: Do not be silent? return nil default: - return fmt.Errorf("Received HTTP code %d while uploading json", res.StatusCode) + errBody, err := ioutil.ReadAll(res.Body) + if err != nil { + errBody = []byte(err.Error()) + } + return fmt.Errorf("HTTP code %d while uploading metadata: %s", res.StatusCode, errBody) } } From 06de045b6d6a2f793294a2b1bb2dc01450575874 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 25 Mar 2013 19:20:18 -0700 Subject: [PATCH 07/16] Force xterm as TERM in tty mode Upstream-commit: c85db1003be5d7cce4c5f94993980acc82db24d3 Component: engine --- components/engine/container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/container.go b/components/engine/container.go index 7693f85a98..d062262dfe 100644 --- a/components/engine/container.go +++ b/components/engine/container.go @@ -256,7 +256,7 @@ func (container *Container) Start() error { var err error if container.Config.Tty { container.cmd.Env = append(container.Config.Env, - "TERM="+os.Getenv("TERM"), + "TERM=xterm", ) err = container.startPty() } else { From cf76570924b3e39e74d09988096c13e05785c2ca Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 25 Mar 2013 19:31:20 -0700 Subject: [PATCH 08/16] MakeRaw on given fd instead of 0 Upstream-commit: 41a2954e4e3f00ef969b2b2ff8308ecc0d3bc673 Component: engine --- components/engine/term/termios_linux.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/components/engine/term/termios_linux.go b/components/engine/term/termios_linux.go index f018a58e63..09d632c303 100644 --- a/components/engine/term/termios_linux.go +++ b/components/engine/term/termios_linux.go @@ -1,7 +1,6 @@ package term import ( - "os" "syscall" "unsafe" ) @@ -9,11 +8,11 @@ import ( // #include // #include /* -void MakeRaw() { +void MakeRaw(int fd) { struct termios t; // FIXME: Handle errors? - ioctl(0, TCGETS, &t); + ioctl(fd, TCGETS, &t); t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); t.c_oflag &= ~OPOST; @@ -21,7 +20,7 @@ void MakeRaw() { t.c_cflag &= ~(CSIZE | PARENB); t.c_cflag |= CS8; - ioctl(0, TCSETS, &t); + ioctl(fd, TCSETS, &t); } */ import "C" @@ -35,14 +34,11 @@ const ( // mode and returns the previous state of the terminal so that it can be // restored. func MakeRaw(fd int) (*State, error) { - - fd = int(os.Stdin.Fd()) - var oldState State if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TCGETS, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { return nil, err } - C.MakeRaw() + C.MakeRaw(C.int(fd)) return &oldState, nil // FIXME: post on goland issues this: very same as the C function bug non-working From 09362ffb5bfd8521ccad0523b34ed12677f6e7a5 Mon Sep 17 00:00:00 2001 From: John Costa Date: Tue, 26 Mar 2013 09:17:44 -0400 Subject: [PATCH 09/16] incorporate feedback from https://github.com/dotcloud/docker/issues/42 Upstream-commit: e53f45f621df0e8004fe3aa482a948eb32b709b6 Component: engine --- components/engine/AUTHORS | 1 + components/engine/README.md | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/engine/AUTHORS b/components/engine/AUTHORS index 85decb361a..7aede7e5ee 100644 --- a/components/engine/AUTHORS +++ b/components/engine/AUTHORS @@ -11,3 +11,4 @@ Ken Cochrane Charles Hooper Guillaume Charmes Daniel Mizyrycki +John Costa diff --git a/components/engine/README.md b/components/engine/README.md index c955a1dcf2..e3eeb41bd0 100644 --- a/components/engine/README.md +++ b/components/engine/README.md @@ -215,11 +215,25 @@ Please take a moment to check that an issue doesn't already exist documenting yo If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests. -### Write tests +### Conventions -Golang has a great testing suite built in: use it! Take a look at existing tests for inspiration. +Fork the repo and make changes on your fork in a feature branch. +- If it's a bugfix branch, name it XXX-something where XXX is the number of the issue +- If it's a feature branch, create an enhancement issue to announce your intentions, and name it XXX-something where XXX is the number of the issue. +Submit unit tests for your changes. Golang has a great testing suite built in: use it! Take a look at existing tests for inspiration. Run the full test suite against your change and the master. + +Submit any relevant updates or additions to documentation. + +Add clean code: + +- Universally formatted code promotes ease of writing, reading, and maintenance. We suggest using gofmt before commiting your changes. There's a git pre-commit hook made for doing so. +- curl -o .git/hooks/pre-commit https://raw.github.com/edsrzf/gofmt-git-hook/master/fmt-check && chmod +x .git/hooks/pre-commit + +Pull requests descriptions should be as clear as possible and include a referenced to all the issues that they address. + +Add your name to the AUTHORS file. Setting up a dev environment ---------------------------- From 5695a50dbc16bf13e96517dbdc37b3c7c95bb8ae Mon Sep 17 00:00:00 2001 From: shin- Date: Tue, 26 Mar 2013 07:10:31 -0700 Subject: [PATCH 10/16] Fixed issue with misplaced cursor after output Upstream-commit: 3cce89d8edc9c3151bd982c6b5acfa8c20d5ae71 Component: engine --- components/engine/term/termios_linux.go | 1 - 1 file changed, 1 deletion(-) diff --git a/components/engine/term/termios_linux.go b/components/engine/term/termios_linux.go index 09d632c303..ef2c84c7e8 100644 --- a/components/engine/term/termios_linux.go +++ b/components/engine/term/termios_linux.go @@ -15,7 +15,6 @@ void MakeRaw(int fd) { ioctl(fd, TCGETS, &t); t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); - t.c_oflag &= ~OPOST; t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); t.c_cflag &= ~(CSIZE | PARENB); t.c_cflag |= CS8; From 2daddd59210a68626e0aae19656cfaedaac477eb Mon Sep 17 00:00:00 2001 From: Mikhail Sobolev Date: Tue, 26 Mar 2013 16:36:49 +0200 Subject: [PATCH 11/16] remove executable bit from lxc_template.go Upstream-commit: b2b6d519c5429eae59d634a9ad1ff690b35e56ee Component: engine --- components/engine/lxc_template.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 components/engine/lxc_template.go diff --git a/components/engine/lxc_template.go b/components/engine/lxc_template.go old mode 100755 new mode 100644 From 81a51af5911ab89eef35f39e5a40ca431fc9f810 Mon Sep 17 00:00:00 2001 From: shin- Date: Tue, 26 Mar 2013 08:31:26 -0700 Subject: [PATCH 12/16] Re-enabled help for run command and added client-side error messages when arguments are missing Upstream-commit: 2333be46aae0473ec244176882bd6188d4c16ce2 Component: engine --- components/engine/commands.go | 4 +++- components/engine/container.go | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index e5deafceda..1f2c3650d7 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -814,14 +814,16 @@ func (srv *Server) CmdTag(stdin io.ReadCloser, stdout io.Writer, args ...string) } func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string) error { - config, err := ParseRun(args) + config, err := ParseRun(args, stdout) if err != nil { return err } if config.Image == "" { + fmt.Fprintln(stdout, "Error: Image not specified") return fmt.Errorf("Image not specified") } if len(config.Cmd) == 0 { + fmt.Fprintln(stdout, "Error: Command not specified") return fmt.Errorf("Command not specified") } // Create new container diff --git a/components/engine/container.go b/components/engine/container.go index d062262dfe..785b351c22 100644 --- a/components/engine/container.go +++ b/components/engine/container.go @@ -3,8 +3,8 @@ package docker import ( "encoding/json" "errors" - "flag" "fmt" + "github.com/dotcloud/docker/rcli" "github.com/kr/pty" "io" "io/ioutil" @@ -60,9 +60,12 @@ type Config struct { Image string // Name of the image as it was passed by the operator (eg. could be symbolic) } -func ParseRun(args []string) (*Config, error) { - cmd := flag.NewFlagSet("", flag.ContinueOnError) - cmd.SetOutput(ioutil.Discard) +func ParseRun(args []string, stdout io.Writer) (*Config, error) { + cmd := rcli.Subcmd(stdout, "run", "[OPTIONS] IMAGE COMMAND [ARG...]", "Run a command in a new container") + if len(args) > 0 && args[0] != "--help" { + cmd.SetOutput(ioutil.Discard) + } + fl_user := cmd.String("u", "", "Username or UID") fl_detach := cmd.Bool("d", false, "Detached mode: leave the container running in the background") fl_stdin := cmd.Bool("i", false, "Keep stdin open even if not attached") From 6b23a9490ba99a353653bc1a489354fdeee70603 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 26 Mar 2013 11:27:36 -0700 Subject: [PATCH 13/16] New 'make github-deploy' rule to deploy the docs to github-pages Upstream-commit: 7db1890c9926191367697826c0de881644a05286 Component: engine --- components/engine/docs/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/engine/docs/Makefile b/components/engine/docs/Makefile index f58854dcdb..55e4ad6eb5 100644 --- a/components/engine/docs/Makefile +++ b/components/engine/docs/Makefile @@ -62,6 +62,11 @@ push: @cd _build/html/ ; \ dotcloud push +github-deploy: docs + rm -fr github-deploy + git clone ssh://git@github.com/dotcloud/docker github-deploy + cd github-deploy && git checkout -f gh-pages && git rm -r * && rsync -avH ../_build/html/ ./ && touch .nojekyll && echo "docker.io" > CNAME && git add * && git commit -m "Updating docs" + $(VERSIONS): @echo "Hello world" From bdb646624870456964154fcbbd5ae9c508f6365e Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 26 Mar 2013 11:46:51 -0700 Subject: [PATCH 14/16] Changed project description in home page Upstream-commit: 84cca8afc82114df1893802c06b2920029908e9d Component: engine --- components/engine/docs/sources/index.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/engine/docs/sources/index.html b/components/engine/docs/sources/index.html index 6a3b363f9e..382f935781 100644 --- a/components/engine/docs/sources/index.html +++ b/components/engine/docs/sources/index.html @@ -72,11 +72,19 @@
-

Docker - the Linux container runtime

+

Docker

+

The Linux container runtime

-

Docker encapsulates heterogeneous payloads in Standard Containers, and runs them on any server with strong guarantees of isolation and repeatability.

+

+ Docker complements LXC with a high-level API which operates at the process level. + It runs unix processes with strong guarantees of isolation and repeatability across servers. +

+ +

+ Docker is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc. +

From f707fd3740c929e1508a608727476f33ba80f5ab Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 26 Mar 2013 11:58:42 -0700 Subject: [PATCH 15/16] Emphasized 'not for production' warning Upstream-commit: 19040035116edf70a42bc825785de6b3f637c120 Component: engine --- components/engine/docs/sources/gettingstarted.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/engine/docs/sources/gettingstarted.html b/components/engine/docs/sources/gettingstarted.html index ba2caf01d0..7d198629cd 100644 --- a/components/engine/docs/sources/gettingstarted.html +++ b/components/engine/docs/sources/gettingstarted.html @@ -62,13 +62,15 @@
+
+ Docker is still under heavy development. It should not yet be used in production. Check the repo for recent progress. +

- Installing on Ubuntu 12.04 and 12.10

-

Please note this project is currently under heavy development. It should not be used in production.

+ Installing on Ubuntu
  1. Install dependencies:

    From 7d23911e9e56511c79eba7dae4132ea8ce6fd588 Mon Sep 17 00:00:00 2001 From: Daniel Mizyrycki Date: Tue, 26 Mar 2013 12:14:58 -0700 Subject: [PATCH 16/16] Add more links and a question to the faq Upstream-commit: 75a116bdaa6f1f734ec73e4fe4a1ef6f810d10ff Component: engine --- .../commandline/basecommands.rst | 4 +++ .../documentation/examples/python_web_app.rst | 6 +++- .../engine/docs/sources/documentation/faq.rst | 36 ++++++++++++++----- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/components/engine/docs/sources/documentation/commandline/basecommands.rst b/components/engine/docs/sources/documentation/commandline/basecommands.rst index 7aa8973657..c764af6bb8 100644 --- a/components/engine/docs/sources/documentation/commandline/basecommands.rst +++ b/components/engine/docs/sources/documentation/commandline/basecommands.rst @@ -61,3 +61,7 @@ Expose a service on a TCP port # Verify that the network connection worked echo "Daemon received: $(docker logs $JOB)" + +Continue to the complete `Command Line Interface`_ + +.. _Command Line Interface: ../commandline/cli.html diff --git a/components/engine/docs/sources/documentation/examples/python_web_app.rst b/components/engine/docs/sources/documentation/examples/python_web_app.rst index 9d988b5160..5fac374889 100644 --- a/components/engine/docs/sources/documentation/examples/python_web_app.rst +++ b/components/engine/docs/sources/documentation/examples/python_web_app.rst @@ -6,7 +6,7 @@ Building a python web app ========================= -The goal of this example is to show you how you can author your own docker images using a parent image, making changes to it, and then saving the results as a new image. We will do that by making a simple hello flask web application image. +The goal of this example is to show you how you can author your own docker images using a parent image, making changes to it, and then saving the results as a new image. We will do that by making a simple hello flask web application image. **Steps:** @@ -64,3 +64,7 @@ See the example in action
    + +Continue to the `base commands`_ + +.. _base commands: ../commandline/basecommands.html diff --git a/components/engine/docs/sources/documentation/faq.rst b/components/engine/docs/sources/documentation/faq.rst index 7b2b54de5f..aa167acd97 100644 --- a/components/engine/docs/sources/documentation/faq.rst +++ b/components/engine/docs/sources/documentation/faq.rst @@ -3,27 +3,45 @@ FAQ Most frequently asked questions. ---------------------------------------------- +-------------------------------- -1. How much does Docker cost? +**1. How much does Docker cost?** Docker is 100% free, it is open source, so you can use it without paying. -2. What open source license are you using? +**2. What open source license are you using?** We are using the Apache License Version 2.0, see it here: https://github.com/dotcloud/docker/blob/master/LICENSE -3. Does Docker run on Mac OS X or Windows? +**3. Does Docker run on Mac OS X or Windows?** -Not at this time, Docker currently only runs on Linux, but you can use VirtualBox to run Docker in a virtual machine on your box, and get the best of both worlds. Check out the getting started guides for help on setting up your machine. +Not at this time, Docker currently only runs on Linux, but you can use VirtualBox to run Docker in a virtual machine on your box, and get the best of both worlds. Check out the MacOSX_ and Windows_ intallation guides. -4. How do containers compare to virtual machines? +**4. How do containers compare to virtual machines?** -Containers are more light weight and can start in less then a second, and are great for lots of different tasks, but they aren't as full featured as virtual machines. +Containers are more light weight and can start in less then a second, and are great for lots of different tasks, but they aren't as full featured as virtual machines. -5. Can I help by adding some questions and answers? +**5. Can I help by adding some questions and answers?** -Definitely! You can fork the repo and edit the documentation sources right there. +Definitely! You can fork `the repo`_ and edit the documentation sources. + + +**42. Where can I find more answers?** + +You can find more answers on: + +* `IRC: docker on freenode`_ +* `Github`_ +* `Ask questions on Stackoverflow`_ +* `Join the conversation on Twitter`_ + +.. _Windows: ../documentation/installation/windows.html +.. _MacOSX: ../documentation/installation/macos.html +.. _the repo: http://www.github.com/dotcloud/docker +.. _IRC\: docker on freenode: irc://chat.freenode.net#docker +.. _Github: http://www.github.com/dotcloud/docker +.. _Ask questions on Stackoverflow: http://stackoverflow.com/search?q=docker +.. _Join the conversation on Twitter: http://twitter.com/getdocker Looking for something else to read? Checkout the :ref:`hello_world` example.