diff --git a/client/client.go b/client/client.go index 815e20a048..30d741f8bd 100644 --- a/client/client.go +++ b/client/client.go @@ -1,8 +1,8 @@ package client import ( - "../future" - "../rcli" + "github.com/dotcloud/docker/future" + "github.com/dotcloud/docker/rcli" "io" "log" "os" diff --git a/container.go b/container.go index cda114907d..c80129e2a8 100644 --- a/container.go +++ b/container.go @@ -1,9 +1,9 @@ package docker import ( - "./fs" "encoding/json" "errors" + "github.com/dotcloud/docker/fs" "github.com/kr/pty" "io" "io/ioutil" diff --git a/container_test.go b/container_test.go index d896553be8..18beeba253 100644 --- a/container_test.go +++ b/container_test.go @@ -1,9 +1,9 @@ package docker import ( - "./fs" "bufio" "fmt" + "github.com/dotcloud/docker/fs" "io" "io/ioutil" "math/rand" diff --git a/docker.go b/docker.go index 49c6d83248..8e8b19082a 100644 --- a/docker.go +++ b/docker.go @@ -1,9 +1,9 @@ package docker import ( - "./fs" "container/list" "fmt" + "github.com/dotcloud/docker/fs" "io/ioutil" "log" "os" diff --git a/docker/docker.go b/docker/docker.go index b43d5b1053..29a550c7b4 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -1,7 +1,7 @@ package main import ( - "../client" + "github.com/dotcloud/docker/client" "log" "os" ) diff --git a/docker_test.go b/docker_test.go index 5e75906c5f..3f51e8d84c 100644 --- a/docker_test.go +++ b/docker_test.go @@ -1,7 +1,7 @@ package docker import ( - "./fs" + "github.com/dotcloud/docker/fs" "io" "io/ioutil" "log" diff --git a/dockerd/dockerd.go b/dockerd/dockerd.go index 22ae8df8e0..b2337d342c 100644 --- a/dockerd/dockerd.go +++ b/dockerd/dockerd.go @@ -1,9 +1,9 @@ package main import ( - ".." - "../server" "flag" + "github.com/dotcloud/docker" + "github.com/dotcloud/docker/server" "log" ) diff --git a/fs/layers.go b/fs/layers.go index 11452fcf2f..be699a8a01 100644 --- a/fs/layers.go +++ b/fs/layers.go @@ -1,9 +1,9 @@ package fs import ( - "../future" "errors" "fmt" + "github.com/dotcloud/docker/future" "io" "io/ioutil" "os" diff --git a/fs/layers_test.go b/fs/layers_test.go index fa4926f542..9f8353fddb 100644 --- a/fs/layers_test.go +++ b/fs/layers_test.go @@ -1,7 +1,7 @@ package fs import ( - "../fake" + "github.com/dotcloud/docker/fake" "io/ioutil" "os" "testing" diff --git a/fs/store.go b/fs/store.go index 4f4ed368e3..36449a0fba 100644 --- a/fs/store.go +++ b/fs/store.go @@ -1,10 +1,10 @@ package fs import ( - "../future" "database/sql" "errors" "fmt" + "github.com/dotcloud/docker/future" _ "github.com/mattn/go-sqlite3" "github.com/shykes/gorp" //Forked to implement CreateTablesOpts "io" diff --git a/fs/store_test.go b/fs/store_test.go index d5715d1ba0..f2cc065342 100644 --- a/fs/store_test.go +++ b/fs/store_test.go @@ -1,9 +1,9 @@ package fs import ( - "../fake" "errors" "fmt" + "github.com/dotcloud/docker/fake" "io/ioutil" "os" "testing" diff --git a/server/server.go b/server/server.go index 94a08a9bf4..18dc578190 100644 --- a/server/server.go +++ b/server/server.go @@ -1,15 +1,15 @@ package server import ( - ".." - "../fs" - "../future" - "../rcli" "bufio" "bytes" "encoding/json" "errors" "fmt" + "github.com/dotcloud/docker" + "github.com/dotcloud/docker/fs" + "github.com/dotcloud/docker/future" + "github.com/dotcloud/docker/rcli" "io" "net/http" "net/url" @@ -60,8 +60,6 @@ func (srv *Server) Help() string { {"mirror", "(debug only) (No documentation available)"}, {"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"}, {"ps", "List containers"}, - {"pull", "Download a new image from a remote location"}, - {"put", "Import a new image from a local archive"}, {"reset", "Reset changes to a container's filesystem"}, {"restart", "Restart a running container"}, {"rm", "Remove a container"}, @@ -71,6 +69,7 @@ func (srv *Server) Help() string { {"stop", "Stop a running container"}, {"tar", "Stream the contents of a container as a tar archive"}, {"umount", "(debug only) Mount a container's filesystem"}, + {"version", "Show the docker version information"}, {"wait", "Block until a container stops, then print its exit code"}, {"web", "A web UI for docker"}, {"write", "Write the contents of standard input to a container's file"}, @@ -100,20 +99,33 @@ func (srv *Server) CmdWait(stdin io.ReadCloser, stdout io.Writer, args ...string return nil } +// 'docker version': show version information +func (srv *Server) CmdVersion(stdin io.ReadCloser, stdout io.Writer, args ...string) error { + fmt.Fprintf(stdout, "Version:%s\n", VERSION) + return nil +} + // 'docker info': display system-wide information. func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string) error { + images, _ := srv.images.Images() + var imgcount int + if images == nil { + imgcount = 0 + } else { + imgcount = len(images) + } cmd := rcli.Subcmd(stdout, "info", "", "Display system-wide information.") if err := cmd.Parse(args); err != nil { return nil } - if cmd.NArg() > 1 { + if cmd.NArg() > 0 { cmd.Usage() return nil } fmt.Fprintf(stdout, "containers: %d\nversion: %s\nimages: %d\n", len(srv.containers.List()), VERSION, - len(srv.images.ById)) + imgcount) return nil } @@ -732,10 +744,17 @@ func (srv *Server) CmdLogs(stdin io.ReadCloser, stdout io.Writer, args ...string return errors.New("No such container: " + cmd.Arg(0)) } -func (srv *Server) CreateContainer(img *fs.Image, ports []int, user string, tty bool, openStdin bool, comment string, cmd string, args ...string) (*docker.Container, error) { +func (srv *Server) CreateContainer(img *fs.Image, ports []int, user string, tty bool, openStdin bool, memory int64, comment string, cmd string, args ...string) (*docker.Container, error) { id := future.RandomId()[:8] container, err := srv.containers.Create(id, cmd, args, img, - &docker.Config{Hostname: id, Ports: ports, User: user, Tty: tty, OpenStdin: openStdin}) + &docker.Config{ + Hostname: id, + Ports: ports, + User: user, + Tty: tty, + OpenStdin: openStdin, + Memory: memory, + }) if err != nil { return nil, err } diff --git a/state.go b/state.go index 6b753ce830..e864f304f9 100644 --- a/state.go +++ b/state.go @@ -1,8 +1,8 @@ package docker import ( - "./future" "fmt" + "github.com/dotcloud/docker/future" "sync" "time" )