mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
added search
This commit is contained in:
commit
59a6316f5e
15 changed files with 237 additions and 89 deletions
22
api.go
22
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) {
|
r.Path("/images/{name:*.}/insert").Methods("POST").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Println(r.Method, r.RequestURI)
|
log.Println(r.Method, r.RequestURI)
|
||||||
if err := r.ParseForm(); err != nil {
|
if err := r.ParseForm(); err != nil {
|
||||||
|
|
|
@ -31,6 +31,11 @@ type ApiContainers struct {
|
||||||
Ports string `json:",omitempty"`
|
Ports string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ApiSearch struct {
|
||||||
|
Name string
|
||||||
|
Description string
|
||||||
|
}
|
||||||
|
|
||||||
type ApiId struct {
|
type ApiId struct {
|
||||||
Id string
|
Id string
|
||||||
}
|
}
|
||||||
|
|
38
commands.go
38
commands.go
|
@ -53,6 +53,7 @@ func ParseCommands(args ...string) error {
|
||||||
|
|
||||||
cmds := map[string]func(args ...string) error{
|
cmds := map[string]func(args ...string) error{
|
||||||
"attach": CmdAttach,
|
"attach": CmdAttach,
|
||||||
|
"build": CmdBuild,
|
||||||
"commit": CmdCommit,
|
"commit": CmdCommit,
|
||||||
"diff": CmdDiff,
|
"diff": CmdDiff,
|
||||||
"export": CmdExport,
|
"export": CmdExport,
|
||||||
|
@ -74,6 +75,7 @@ func ParseCommands(args ...string) error {
|
||||||
"rmi": CmdRmi,
|
"rmi": CmdRmi,
|
||||||
"run": CmdRun,
|
"run": CmdRun,
|
||||||
"tag": CmdTag,
|
"tag": CmdTag,
|
||||||
|
"search": CmdSearch,
|
||||||
"start": CmdStart,
|
"start": CmdStart,
|
||||||
"stop": CmdStop,
|
"stop": CmdStop,
|
||||||
"version": CmdVersion,
|
"version": CmdVersion,
|
||||||
|
@ -116,6 +118,7 @@ func cmdHelp(args ...string) error {
|
||||||
{"rm", "Remove a container"},
|
{"rm", "Remove a container"},
|
||||||
{"rmi", "Remove an image"},
|
{"rmi", "Remove an image"},
|
||||||
{"run", "Run a command in a new container"},
|
{"run", "Run a command in a new container"},
|
||||||
|
{"search", "Search for an image in the docker index"},
|
||||||
{"start", "Start a stopped container"},
|
{"start", "Start a stopped container"},
|
||||||
{"stop", "Stop a running container"},
|
{"stop", "Stop a running container"},
|
||||||
{"tag", "Tag an image into a repository"},
|
{"tag", "Tag an image into a repository"},
|
||||||
|
@ -948,6 +951,41 @@ func CmdAttach(args ...string) error {
|
||||||
return nil
|
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
|
// ListOpts type
|
||||||
type ListOpts []string
|
type ListOpts []string
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ Installation
|
||||||
|
|
||||||
* Work in your own fork of the code, we accept pull requests.
|
* Work in your own fork of the code, we accept pull requests.
|
||||||
* Install sphinx: ``pip install sphinx``
|
* 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**
|
* If pip is not available you can probably install it using your favorite package manager as **python-pip**
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
|
|
@ -47,6 +47,7 @@ Available Commands
|
||||||
command/rm
|
command/rm
|
||||||
command/rmi
|
command/rmi
|
||||||
command/run
|
command/run
|
||||||
|
command/search
|
||||||
command/start
|
command/start
|
||||||
command/stop
|
command/stop
|
||||||
command/tag
|
command/tag
|
||||||
|
|
10
docs/sources/commandline/command/search.rst
Normal file
10
docs/sources/commandline/command/search.rst
Normal file
|
@ -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.
|
|
@ -2,9 +2,9 @@
|
||||||
:description: Sharing data between 2 couchdb databases
|
:description: Sharing data between 2 couchdb databases
|
||||||
:keywords: docker, example, package installation, networking, couchdb, data volumes
|
: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
|
.. include:: example_header.inc
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="google-site-verification" content="UxV66EKuPe87dgnH1sbrldrx6VsoWMrx5NjwkgUFxXI" />
|
||||||
<title>Docker - the Linux container engine</title>
|
<title>Docker - the Linux container engine</title>
|
||||||
|
|
||||||
<meta name="description" content="Docker encapsulates heterogeneous payloads in standard containers">
|
<meta name="description" content="Docker encapsulates heterogeneous payloads in standard containers">
|
||||||
|
@ -23,6 +24,29 @@
|
||||||
<script src="_static/js/vendor/jquery-1.9.1.min.js" type="text/javascript" ></script>
|
<script src="_static/js/vendor/jquery-1.9.1.min.js" type="text/javascript" ></script>
|
||||||
<script src="_static/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js" type="text/javascript" ></script>
|
<script src="_static/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js" type="text/javascript" ></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.indexlabel {
|
||||||
|
float: left;
|
||||||
|
width: 150px;
|
||||||
|
display: block;
|
||||||
|
padding: 10px 20px 10px;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 200;
|
||||||
|
background-color: #a30000;
|
||||||
|
color: white;
|
||||||
|
height: 22px;
|
||||||
|
}
|
||||||
|
.searchbutton {
|
||||||
|
font-size: 20px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.debug {
|
||||||
|
border: 1px red dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,58 +73,39 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container" style="margin-top: 30px;">
|
||||||
<div class="row">
|
|
||||||
<div class="text-center">
|
|
||||||
<img src="_static/img/docker-letters-logo.gif">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<section class="contentblock header">
|
<section class="contentblock header">
|
||||||
|
|
||||||
<div class="span6" style="margin:10px 0px 0px 30px; float: right; ">
|
<div class="span5" style="margin-bottom: 15px;">
|
||||||
<div class="js-video" >
|
<div style="text-align: center;" >
|
||||||
<iframe width="640" height="360" src="http://www.youtube.com/embed/wW9CAH9nSLs?feature=player_detailpage&rel=0&modestbranding=1&start=11" frameborder="0" allowfullscreen></iframe>
|
<img src="_static/img/docker_letters_500px.png">
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="text-align: center; padding: 50px 30px 50px 30px;">
|
|
||||||
<h1>Docker</h1>
|
|
||||||
<h2>The Linux container engine</h2>
|
<h2>The Linux container engine</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display: block; text-align: center; padding: 10px 30px 50px 30px;">
|
<div style="display: block; text-align: center; margin-top: 20px;">
|
||||||
|
|
||||||
<p>
|
<h5>
|
||||||
Docker is an open-source engine which automates the deployment of applications as highly portable, self-sufficient containers.
|
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.
|
||||||
</p>
|
</h5>
|
||||||
|
|
||||||
<p>
|
|
||||||
Docker containers are both <string>hardware-agnostic</strong> and <strong>platform-agnostic</strong>. 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.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Docker is an open-source implementation of the deployment engine which powers <a href="http://dotcloud.com">dotCloud</a>, 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.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div style="display: block; text-align: center;">
|
<div style="display: block; text-align: center; margin-top: 30px;">
|
||||||
<a class="btn btn-custom btn-large" href="gettingstarted/">Let's get started</a>
|
<a class="btn btn-custom btn-large" href="gettingstarted/">Let's get started</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span6" >
|
||||||
|
<div class="js-video" >
|
||||||
|
<iframe width="600" height="360" src="http://www.youtube.com/embed/wW9CAH9nSLs?feature=player_detailpage&rel=0&modestbranding=1&start=11" frameborder="0" allowfullscreen></iframe>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<br style="clear: both"/>
|
<br style="clear: both"/>
|
||||||
</section>
|
</section>
|
||||||
|
@ -111,31 +116,56 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="span3">
|
<div class="span6">
|
||||||
<section class="contentblock">
|
<section class="contentblock">
|
||||||
<h4>Heterogeneous payloads</h4>
|
<h4>Heterogeneous payloads</h4>
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<div class="span3">
|
|
||||||
<section class="contentblock">
|
|
||||||
<h4>Any server</h4>
|
<h4>Any server</h4>
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<div class="span3">
|
|
||||||
<section class="contentblock">
|
|
||||||
<h4>Isolation</h4>
|
<h4>Isolation</h4>
|
||||||
<p>docker isolates processes from each other and from the underlying host, using lightweight containers.</p>
|
<p>Docker isolates processes from each other and from the underlying host, using lightweight containers.</p>
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
<div class="span3">
|
|
||||||
<section class="contentblock">
|
|
||||||
<h4>Repeatability</h4>
|
<h4>Repeatability</h4>
|
||||||
<p>Because containers are isolated in their own filesystem, they behave the same regardless of where, when, and alongside what they run.</p>
|
<p>Because each container is isolated in its own filesystem, they behave the same regardless of where, when, and alongside what they run.</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="span6">
|
||||||
|
<section class="contentblock">
|
||||||
|
<h1>New! Docker Index</h1>
|
||||||
|
On the Docker Index you can find and explore pre-made container images. It allows you to share your images and download them.
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<a href="https://index.docker.io" target="_blank">
|
||||||
|
<div class="indexlabel">
|
||||||
|
DOCKER index
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<input type="button" class="searchbutton" type="submit" value="Search images"
|
||||||
|
onClick="window.open('https://index.docker.io')" />
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<section class="contentblock">
|
||||||
|
<div id="wufoo-z7x3p3">
|
||||||
|
Fill out my <a href="http://dotclouddocker.wufoo.com/forms/z7x3p3">online form</a>.
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">var z7x3p3;(function(d, t) {
|
||||||
|
var s = d.createElement(t), options = {
|
||||||
|
'userName':'dotclouddocker',
|
||||||
|
'formHash':'z7x3p3',
|
||||||
|
'autoResize':true,
|
||||||
|
'height':'577',
|
||||||
|
'async':true,
|
||||||
|
'header':'show'};
|
||||||
|
s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'wufoo.com/scripts/embed/form.js';
|
||||||
|
s.onload = s.onreadystatechange = function() {
|
||||||
|
var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
|
||||||
|
try { z7x3p3 = new WufooForm();z7x3p3.initialize(options);z7x3p3.display(); } catch (e) {}};
|
||||||
|
var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
|
||||||
|
})(document, 'script');</script>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -183,18 +213,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <p>Docker encapsulates heterogeneous payloads in <a href="#container">Standard Containers</a>, and runs them on any server with strong guarantees of isolation and repeatability.</p>
|
|
||||||
|
|
||||||
<p>It is a great building block for automating distributed systems: large-scale web deployments, database clusters, continuous deployment systems, private PaaS, service-oriented architectures, etc.</p>
|
|
||||||
|
|
||||||
-->
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
|
|
||||||
<section class="contentblock">
|
<section class="contentblock">
|
||||||
|
|
||||||
<!-- <img src="_static/lego_docker.jpg" width="600px" style="float:right; margin-left: 10px"> -->
|
|
||||||
<h2>Notable features</h2>
|
<h2>Notable features</h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -218,35 +242,26 @@
|
||||||
<li><a href="http://lxc.sourceforge.net/">lxc</a>, a set of convenience scripts to simplify the creation of linux containers.</li>
|
<li><a href="http://lxc.sourceforge.net/">lxc</a>, a set of convenience scripts to simplify the creation of linux containers.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h2>Who started it</h2>
|
||||||
|
<p>
|
||||||
|
Docker is an open-source implementation of the deployment engine which powers <a href="http://dotcloud.com">dotCloud</a>, a popular Platform-as-a-Service.</p>
|
||||||
|
|
||||||
|
<p>It benefits directly from the experience accumulated over several years of large-scale operation and support of hundreds of thousands
|
||||||
|
of applications and databases.
|
||||||
|
</p>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<section class="contentblock">
|
|
||||||
<div id="wufoo-z7x3p3">
|
|
||||||
Fill out my <a href="http://dotclouddocker.wufoo.com/forms/z7x3p3">online form</a>.
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">var z7x3p3;(function(d, t) {
|
|
||||||
var s = d.createElement(t), options = {
|
|
||||||
'userName':'dotclouddocker',
|
|
||||||
'formHash':'z7x3p3',
|
|
||||||
'autoResize':true,
|
|
||||||
'height':'577',
|
|
||||||
'async':true,
|
|
||||||
'header':'show'};
|
|
||||||
s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'wufoo.com/scripts/embed/form.js';
|
|
||||||
s.onload = s.onreadystatechange = function() {
|
|
||||||
var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
|
|
||||||
try { z7x3p3 = new WufooForm();z7x3p3.initialize(options);z7x3p3.display(); } catch (e) {}};
|
|
||||||
var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
|
|
||||||
})(document, 'script');</script>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="contentblock">
|
<section class="contentblock">
|
||||||
<h3 id="twitter">Twitter</h3>
|
<h3 id="twitter">Twitter</h3>
|
||||||
<a class="twitter-timeline" href="https://twitter.com/getdocker" data-widget-id="312730839718957056">Tweets by @getdocker</a>
|
<a class="twitter-timeline" href="https://twitter.com/getdocker" data-widget-id="312730839718957056">Tweets by @getdocker</a>
|
||||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
3
docs/theme/docker/layout.html
vendored
3
docs/theme/docker/layout.html
vendored
|
@ -6,6 +6,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="google-site-verification" content="UxV66EKuPe87dgnH1sbrldrx6VsoWMrx5NjwkgUFxXI" />
|
||||||
|
|
||||||
<title>Docker - {{ meta['title'] if meta and meta['title'] else title }}</title>
|
<title>Docker - {{ meta['title'] if meta and meta['title'] else title }}</title>
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-left: -12px; float: left;">
|
<div style="margin-left: -12px; float: left;">
|
||||||
<a href="{{ pathto('./', 1) }}"><img style="margin-top: 12px; height: 38px" src="{{ pathto('_static/img/docker-letters-logo.gif', 1) }}"></a>
|
<a href="http://www.docker.io"><img style="margin-top: 12px; height: 38px" src="{{ pathto('_static/img/docker-letters-logo.gif', 1) }}"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
2
docs/theme/docker/static/css/main.css
vendored
2
docs/theme/docker/static/css/main.css
vendored
|
@ -82,7 +82,7 @@ h4 {
|
||||||
.btn-custom {
|
.btn-custom {
|
||||||
background-color: #292929 !important;
|
background-color: #292929 !important;
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#515151", endColorstr="#282828");
|
filter: progid:dximagetransform.microsoft.gradient(startColorstr="#515151", endColorstr="#282828");
|
||||||
background-image: -khtml-gradient(linear, left top, left bottom, from(#515151), to(#282828));
|
background-image: -khtml-gradient(linear, left top, left bottom, from(#515151), to(#282828));
|
||||||
background-image: -moz-linear-gradient(top, #515151, #282828);
|
background-image: -moz-linear-gradient(top, #515151, #282828);
|
||||||
background-image: -ms-linear-gradient(top, #515151, #282828);
|
background-image: -ms-linear-gradient(top, #515151, #282828);
|
||||||
|
|
BIN
docs/theme/docker/static/img/docker_letters_500px.png
vendored
Normal file
BIN
docs/theme/docker/static/img/docker_letters_500px.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
36
registry.go
36
registry.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
@ -211,6 +212,11 @@ func (graph *Graph) getRemoteTags(stdout io.Writer, registries []string, reposit
|
||||||
|
|
||||||
func (graph *Graph) getImageForTag(stdout io.Writer, tag, remote, registry string, token []string) (string, error) {
|
func (graph *Graph) getImageForTag(stdout io.Writer, tag, remote, registry string, token []string) (string, error) {
|
||||||
client := graph.getHttpClient()
|
client := graph.getHttpClient()
|
||||||
|
|
||||||
|
if !strings.Contains(remote, "/") {
|
||||||
|
remote = "library/" + remote
|
||||||
|
}
|
||||||
|
|
||||||
registryEndpoint := "https://" + registry + "/v1"
|
registryEndpoint := "https://" + registry + "/v1"
|
||||||
repositoryTarget := registryEndpoint + "/repositories/" + remote + "/tags/" + tag
|
repositoryTarget := registryEndpoint + "/repositories/" + remote + "/tags/" + tag
|
||||||
|
|
||||||
|
@ -638,3 +644,33 @@ func (graph *Graph) Checksums(output io.Writer, repo Repository) ([]map[string]s
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SearchResults struct {
|
||||||
|
Query string `json:"query"`
|
||||||
|
NumResults int `json:"num_results"`
|
||||||
|
Results []map[string]string `json:"results"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (graph *Graph) SearchRepositories(stdout io.Writer, term string) (*SearchResults, error) {
|
||||||
|
client := graph.getHttpClient()
|
||||||
|
u := INDEX_ENDPOINT + "/search?q=" + url.QueryEscape(term)
|
||||||
|
req, err := http.NewRequest("GET", u, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
res, err := client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
if res.StatusCode != 200 {
|
||||||
|
return nil, fmt.Errorf("Unexepected status code %d", res.StatusCode)
|
||||||
|
}
|
||||||
|
rawData, err := ioutil.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := new(SearchResults)
|
||||||
|
err = json.Unmarshal(rawData, result)
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ func init() {
|
||||||
runtime: runtime,
|
runtime: runtime,
|
||||||
}
|
}
|
||||||
// Retrieve the Image
|
// Retrieve the Image
|
||||||
if err := srv.ImagePull(unitTestImageName, os.Stdout); err != nil {
|
if err := srv.ImagePull(unitTestImageName, "", "", os.Stdout); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
server.go
19
server.go
|
@ -43,6 +43,25 @@ func (srv *Server) ContainerExport(name string, file *os.File) error {
|
||||||
return fmt.Errorf("No such container: %s", name)
|
return fmt.Errorf("No such container: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (srv *Server) ImagesSearch(term string) ([]ApiSearch, error) {
|
||||||
|
results, err := srv.runtime.graph.SearchRepositories(nil, term)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var outs []ApiSearch
|
||||||
|
for _, repo := range results.Results {
|
||||||
|
var out ApiSearch
|
||||||
|
out.Description = repo["description"]
|
||||||
|
if len(out.Description) > 45 {
|
||||||
|
out.Description = Trunc(out.Description, 42) + "..."
|
||||||
|
}
|
||||||
|
out.Name = repo["name"]
|
||||||
|
outs = append(outs, out)
|
||||||
|
}
|
||||||
|
return outs, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (srv *Server) ImageInsert(name, url, path string, stdout *os.File) error {
|
func (srv *Server) ImageInsert(name, url, path string, stdout *os.File) error {
|
||||||
img, err := srv.runtime.repositories.LookupImage(name)
|
img, err := srv.runtime.repositories.LookupImage(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -13,7 +13,7 @@ func TestCreateRm(t *testing.T) {
|
||||||
|
|
||||||
srv := &Server{runtime: runtime}
|
srv := &Server{runtime: runtime}
|
||||||
|
|
||||||
config, _, err := ParseRun([]string{GetTestImage(runtime).Id, "echo test"})
|
config, _, err := ParseRun([]string{GetTestImage(runtime).Id, "echo test"}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ func TestCreateStartRestartStopStartKillRm(t *testing.T) {
|
||||||
|
|
||||||
srv := &Server{runtime: runtime}
|
srv := &Server{runtime: runtime}
|
||||||
|
|
||||||
config, _, err := ParseRun([]string{GetTestImage(runtime).Id, "/bin/cat"})
|
config, _, err := ParseRun([]string{GetTestImage(runtime).Id, "/bin/cat"}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue