diff --git a/client/client.go b/client/client.go index a277a4b18f1df588e7b85f35cb3d4427c34aaa17..4c4ea1c5e3d25670cc3c7ee7829fa85cd2bccab7 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" "io/ioutil" "log" diff --git a/container.go b/container.go index 52a330621b252086640c86461afa65be7540b16e..aa1acc3c4ca8e807b4c09d20ecbe0e321084bbc0 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" @@ -129,6 +129,8 @@ func loadContainer(store *fs.Store, containerPath string, netManager *NetworkMan ) if err != nil { return nil, err + } else if mountpoint == nil { + return nil, errors.New("Couldn't load container: unregistered mountpoint.") } container := &Container{ stdout: newWriteBroadcaster(), diff --git a/docker.go b/docker.go index 49c6d832484cafbb9cd3650126b353dfc0e87552..2561d73e1174fe5f119cad3ddf00839e17abf704 100644 --- a/docker.go +++ b/docker.go @@ -1,7 +1,7 @@ package docker import ( - "./fs" + "github.com/dotcloud/docker/fs" "container/list" "fmt" "io/ioutil" diff --git a/docker/docker.go b/docker/docker.go index df8a0944307be6954d65d7ca8d7e857f8fcb9bdb..73939abb69d2b5e3e2a9fa7b4b70d64b200ff9b6 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -1,7 +1,7 @@ package main import ( - "../client" + "github.com/dotcloud/docker/client" "flag" "log" "os" diff --git a/dockerd/dockerd.go b/dockerd/dockerd.go index 22ae8df8e0a881173f275f8339c9ec2f6338bb3e..456dfe9d61e83b51cc787f8c5423801200796c6b 100644 --- a/dockerd/dockerd.go +++ b/dockerd/dockerd.go @@ -1,8 +1,8 @@ package main import ( - ".." - "../server" + "github.com/dotcloud/docker" + "github.com/dotcloud/docker/server" "flag" "log" ) diff --git a/fs/layers.go b/fs/layers.go index 11452fcf2fdef98864ea25cdd2360092cb44ae03..b7d97bd7f0431f2f8252b0a0e854a02d12849217 100644 --- a/fs/layers.go +++ b/fs/layers.go @@ -1,7 +1,7 @@ package fs import ( - "../future" + "github.com/dotcloud/docker/future" "errors" "fmt" "io" diff --git a/fs/store_test.go b/fs/store_test.go index d5715d1ba0d049fa7f5c78825e324a1e0ec7c887..33bb16c92c1047b55099e4cb98e5221978b0c97c 100644 --- a/fs/store_test.go +++ b/fs/store_test.go @@ -1,7 +1,7 @@ package fs import ( - "../fake" + "github.com/dotcloud/docker/fake" "errors" "fmt" "io/ioutil" diff --git a/server/server.go b/server/server.go index 654ca03c1af2db4c6a83605eb762e12b6300c780..cbec3edc05ac3ab4d38104bddd4d0ab18b7ecfc0 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" @@ -42,8 +42,7 @@ func (srv *Server) Help() string { for _, cmd := range [][]interface{}{ {"run", "Run a command in a container"}, {"ps", "Display a list of containers"}, - {"pull", "Download a tarball and create a container from it"}, - {"put", "Upload a tarball and create a container from it"}, + {"import", "Create a new filesystem image from the contents of a tarball"}, {"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"}, {"rm", "Remove containers"}, {"kill", "Kill a running container"}, @@ -409,36 +408,42 @@ func (srv *Server) CmdKill(stdin io.ReadCloser, stdout io.Writer, args ...string return nil } -func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string) error { - cmd := rcli.Subcmd(stdout, "pull", "[OPTIONS] NAME", "Download a new image from a remote location") +func (srv *Server) CmdImport(stdin io.ReadCloser, stdout io.Writer, args ...string) error { + cmd := rcli.Subcmd(stdout, "import", "[OPTIONS] NAME", "Create a new filesystem image from the contents of a tarball") + fl_stdin := cmd.Bool("stdin", false, "Read tarball from stdin") if err := cmd.Parse(args); err != nil { return nil } + var archive io.Reader name := cmd.Arg(0) if name == "" { return errors.New("Not enough arguments") } - u, err := url.Parse(name) - if err != nil { - return err - } - if u.Scheme == "" { - u.Scheme = "http" - } - // FIXME: hardcode a mirror URL that does not depend on a single provider. - if u.Host == "" { - u.Host = "s3.amazonaws.com" - u.Path = path.Join("/docker.io/images", u.Path) - } - fmt.Fprintf(stdout, "Downloading from %s\n", u.String()) - // Download with curl (pretty progress bar) - // If curl is not available, fallback to http.Get() - archive, err := future.Curl(u.String(), stdout) - if err != nil { - if resp, err := http.Get(u.String()); err != nil { + if *fl_stdin { + archive = stdin + } else { + u, err := url.Parse(name) + if err != nil { return err - } else { - archive = resp.Body + } + if u.Scheme == "" { + u.Scheme = "http" + } + // FIXME: hardcode a mirror URL that does not depend on a single provider. + if u.Host == "" { + u.Host = "s3.amazonaws.com" + u.Path = path.Join("/docker.io/images", u.Path) + } + fmt.Fprintf(stdout, "Downloading from %s\n", u.String()) + // Download with curl (pretty progress bar) + // If curl is not available, fallback to http.Get() + archive, err = future.Curl(u.String(), stdout) + if err != nil { + if resp, err := http.Get(u.String()); err != nil { + return err + } else { + archive = resp.Body + } } } fmt.Fprintf(stdout, "Unpacking to %s\n", name) @@ -450,23 +455,6 @@ func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string return nil } -func (srv *Server) CmdPut(stdin io.ReadCloser, stdout io.Writer, args ...string) error { - cmd := rcli.Subcmd(stdout, "put", "[OPTIONS] NAME", "Import a new image from a local archive.") - if err := cmd.Parse(args); err != nil { - return nil - } - name := cmd.Arg(0) - if name == "" { - return errors.New("Not enough arguments") - } - img, err := srv.images.Create(stdin, nil, name, "") - if err != nil { - return err - } - fmt.Fprintln(stdout, img.Id) - return nil -} - func (srv *Server) CmdImages(stdin io.ReadCloser, stdout io.Writer, args ...string) error { cmd := rcli.Subcmd(stdout, "images", "[OPTIONS] [NAME]", "List images") limit := cmd.Int("l", 0, "Only show the N most recent versions of each image")