diff --git a/api.go b/api.go index 55bf5c38f9..073a469522 100644 --- a/api.go +++ b/api.go @@ -365,6 +365,28 @@ func ListenAndServe(addr string, srv *Server) error { } }) + r.Path("/images/search").Methods("GET").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + log.Println(r.Method, r.RequestURI) + if err := r.ParseForm(); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + term := r.Form.Get("term") + outs, err := srv.ImagesSearch(term) + if err != nil { + httpError(w, err) + return + } + b, err := json.Marshal(outs) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } else { + w.Header().Set("Content-Type", "application/json") + w.Write(b) + } + }) + r.Path("/images/{name:*.}/insert").Methods("POST").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { log.Println(r.Method, r.RequestURI) if err := r.ParseForm(); err != nil { diff --git a/api_params.go b/api_params.go index b86265b178..d57637abd7 100644 --- a/api_params.go +++ b/api_params.go @@ -31,6 +31,11 @@ type ApiContainers struct { Ports string `json:",omitempty"` } +type ApiSearch struct { + Name string + Description string +} + type ApiId struct { Id string } diff --git a/commands.go b/commands.go index 540f279e8d..d693bfc857 100644 --- a/commands.go +++ b/commands.go @@ -53,6 +53,7 @@ func ParseCommands(args ...string) error { cmds := map[string]func(args ...string) error{ "attach": CmdAttach, + "build": CmdBuild, "commit": CmdCommit, "diff": CmdDiff, "export": CmdExport, @@ -74,6 +75,7 @@ func ParseCommands(args ...string) error { "rmi": CmdRmi, "run": CmdRun, "tag": CmdTag, + "search": CmdSearch, "start": CmdStart, "stop": CmdStop, "version": CmdVersion, @@ -116,6 +118,7 @@ func cmdHelp(args ...string) error { {"rm", "Remove a container"}, {"rmi", "Remove an image"}, {"run", "Run a command in a new container"}, + {"search", "Search for an image in the docker index"}, {"start", "Start a stopped container"}, {"stop", "Stop a running container"}, {"tag", "Tag an image into a repository"}, @@ -948,6 +951,41 @@ func CmdAttach(args ...string) error { return nil } +func CmdSearch(args ...string) error { + cmd := Subcmd("search", "NAME", "Search the docker index for images") + if err := cmd.Parse(args); err != nil { + return nil + } + if cmd.NArg() != 1 { + cmd.Usage() + return nil + } + + v := url.Values{} + v.Set("term", cmd.Arg(0)) + body, _, err := call("GET", "/images/search?"+v.Encode(), nil) + if err != nil { + return err + } + + var outs []ApiSearch + err = json.Unmarshal(body, &outs) + if err != nil { + return err + } + fmt.Printf("Found %d results matching your query (\"%s\")\n", len(outs), cmd.Arg(0)) + w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0) + fmt.Fprintf(w, "NAME\tDESCRIPTION\n") + for _, out := range outs { + fmt.Fprintf(w, "%s\t%s\n", out.Name, out.Description) + } + w.Flush() + return nil +} + +// Ports type - Used to parse multiple -p flags +type ports []int + // ListOpts type type ListOpts []string diff --git a/docs/README.md b/docs/README.md index fce7f238fb..e1ca45b085 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,6 +15,7 @@ Installation * Work in your own fork of the code, we accept pull requests. * Install sphinx: ``pip install sphinx`` +* Install sphinx httpdomain contrib package ``sphinxcontrib-httpdomain`` * If pip is not available you can probably install it using your favorite package manager as **python-pip** Usage diff --git a/docs/sources/commandline/cli.rst b/docs/sources/commandline/cli.rst index 46ea3e4a7f..47ecb79e67 100644 --- a/docs/sources/commandline/cli.rst +++ b/docs/sources/commandline/cli.rst @@ -47,6 +47,7 @@ Available Commands command/rm command/rmi command/run + command/search command/start command/stop command/tag diff --git a/docs/sources/commandline/command/search.rst b/docs/sources/commandline/command/search.rst new file mode 100644 index 0000000000..0af24dfaf5 --- /dev/null +++ b/docs/sources/commandline/command/search.rst @@ -0,0 +1,10 @@ +=================================================================== +``search`` -- Search for an image in the docker index +=================================================================== + +:: + + Usage: docker search TERM + + Searches for the TERM parameter on the Docker index and prints out a list of repositories + that match. diff --git a/docs/sources/examples/couchdb_data_volumes.rst b/docs/sources/examples/couchdb_data_volumes.rst index 5b50c73e38..df1b5299a4 100644 --- a/docs/sources/examples/couchdb_data_volumes.rst +++ b/docs/sources/examples/couchdb_data_volumes.rst @@ -2,9 +2,9 @@ :description: Sharing data between 2 couchdb databases :keywords: docker, example, package installation, networking, couchdb, data volumes -.. _running_redis_service: +.. _running_couchdb_service: -Create a redis service +Create a CouchDB service ====================== .. include:: example_header.inc diff --git a/docs/sources/index.html b/docs/sources/index.html index 1d5313cf5c..44a1cc737c 100644 --- a/docs/sources/index.html +++ b/docs/sources/index.html @@ -7,6 +7,7 @@ + Docker - the Linux container engine @@ -23,6 +24,29 @@ + + @@ -49,59 +73,40 @@ -
-
-
- -
-
-
- -
+
-
+
+
+ + +

The Linux container engine

+
+ +
+ +
+ Docker is an open-source engine which automates the deployment of applications as highly portable, self-sufficient containers which are independent of hardware, language, framework, packaging system and hosting provider. +
+ +
+ + + + +
+ +
- +
-
-

Docker

-

The Linux container engine

-
- -
- -

- Docker is an open-source engine which automates the deployment of applications as highly portable, self-sufficient containers. -

- -

- Docker containers are both hardware-agnostic and platform-agnostic. This means that they can run anywhere, from your - laptop to the largest EC2 compute instance and everything in between - and they don't require that you use a particular - language, framework or packaging system. That makes them great building blocks for deploying and scaling web apps, databases - and backend services without depending on a particular stack or provider. -

- -

- Docker is an open-source implementation of the deployment engine which powers dotCloud, a popular Platform-as-a-Service. - It benefits directly from the experience accumulated over several years of large-scale operation and support of hundreds of thousands - of applications and databases. -

- -
- - - - - -
@@ -111,31 +116,56 @@
-
+

Heterogeneous payloads

Any combination of binaries, libraries, configuration files, scripts, virtualenvs, jars, gems, tarballs, you name it. No more juggling between domain-specific tools. Docker can deploy and run them all.

-
-
-
-

Any server

Docker can run on any x64 machine with a modern linux kernel - whether it's a laptop, a bare metal server or a VM. This makes it perfect for multi-cloud deployments.

-
-
-
-

Isolation

-

docker isolates processes from each other and from the underlying host, using lightweight containers.

+

Docker isolates processes from each other and from the underlying host, using lightweight containers.

+

Repeatability

+

Because each container is isolated in its own filesystem, they behave the same regardless of where, when, and alongside what they run.

-
+
-

Repeatability

-

Because containers are isolated in their own filesystem, they behave the same regardless of where, when, and alongside what they run.

+

New! Docker Index

+ On the Docker Index you can find and explore pre-made container images. It allows you to share your images and download them. + +

+ +
+ DOCKER index +
+
+   + + +
+
+
+ Fill out my online form. +
+
+