diff --git a/AUTHORS b/AUTHORS index 85decb361a..7aede7e5ee 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,3 +11,4 @@ Ken Cochrane Charles Hooper Guillaume Charmes Daniel Mizyrycki +John Costa diff --git a/commands.go b/commands.go index a0a322afab..1f2c3650d7 100644 --- a/commands.go +++ b/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 } @@ -297,7 +300,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 } @@ -472,19 +478,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 } @@ -812,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/container.go b/container.go index 7e7077c123..785b351c22 100644 --- a/container.go +++ b/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") @@ -255,6 +258,9 @@ func (container *Container) Start() error { var err error if container.Config.Tty { + container.cmd.Env = append(container.Config.Env, + "TERM=xterm", + ) err = container.startPty() } else { err = container.start() diff --git a/docs/Makefile b/docs/Makefile index a9006a062d..d7602ae826 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -64,6 +64,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" diff --git a/docs/sources/documentation/commandline/basecommands.rst b/docs/sources/documentation/commandline/basecommands.rst index 7aa8973657..c764af6bb8 100644 --- a/docs/sources/documentation/commandline/basecommands.rst +++ b/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/docs/sources/documentation/examples/python_web_app.rst b/docs/sources/documentation/examples/python_web_app.rst index 9d988b5160..5fac374889 100644 --- a/docs/sources/documentation/examples/python_web_app.rst +++ b/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
Please note this project is currently under heavy development. It should not be used in production.
+ Installing on UbuntuInstall dependencies:
diff --git a/docs/sources/index.html b/docs/sources/index.html index 6a3b363f9e..382f935781 100644 --- a/docs/sources/index.html +++ b/docs/sources/index.html @@ -72,11 +72,19 @@+ 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. +