mirror of https://github.com/docker/docs.git
Merged master
This commit is contained in:
commit
86854ffbc5
|
@ -1,8 +1,8 @@
|
||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../future"
|
"github.com/dotcloud/docker/future"
|
||||||
"../rcli"
|
"github.com/dotcloud/docker/rcli"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"./fs"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/dotcloud/docker/fs"
|
||||||
"github.com/kr/pty"
|
"github.com/kr/pty"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"./fs"
|
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dotcloud/docker/fs"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"./fs"
|
|
||||||
"container/list"
|
"container/list"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dotcloud/docker/fs"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../client"
|
"github.com/dotcloud/docker/client"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package docker
|
package docker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"./fs"
|
"github.com/dotcloud/docker/fs"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
".."
|
|
||||||
"../server"
|
|
||||||
"flag"
|
"flag"
|
||||||
|
"github.com/dotcloud/docker"
|
||||||
|
"github.com/dotcloud/docker/server"
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package fs
|
package fs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../future"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dotcloud/docker/future"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package fs
|
package fs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../fake"
|
"github.com/dotcloud/docker/fake"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package fs
|
package fs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../future"
|
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dotcloud/docker/future"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"github.com/shykes/gorp" //Forked to implement CreateTablesOpts
|
"github.com/shykes/gorp" //Forked to implement CreateTablesOpts
|
||||||
"io"
|
"io"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package fs
|
package fs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../fake"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dotcloud/docker/fake"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
".."
|
|
||||||
"../fs"
|
|
||||||
"../future"
|
|
||||||
"../rcli"
|
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dotcloud/docker"
|
||||||
|
"github.com/dotcloud/docker/fs"
|
||||||
|
"github.com/dotcloud/docker/future"
|
||||||
|
"github.com/dotcloud/docker/rcli"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -60,8 +60,6 @@ func (srv *Server) Help() string {
|
||||||
{"mirror", "(debug only) (No documentation available)"},
|
{"mirror", "(debug only) (No documentation available)"},
|
||||||
{"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"},
|
{"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"},
|
||||||
{"ps", "List containers"},
|
{"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"},
|
{"reset", "Reset changes to a container's filesystem"},
|
||||||
{"restart", "Restart a running container"},
|
{"restart", "Restart a running container"},
|
||||||
{"rm", "Remove a container"},
|
{"rm", "Remove a container"},
|
||||||
|
@ -71,6 +69,7 @@ func (srv *Server) Help() string {
|
||||||
{"stop", "Stop a running container"},
|
{"stop", "Stop a running container"},
|
||||||
{"tar", "Stream the contents of a container as a tar archive"},
|
{"tar", "Stream the contents of a container as a tar archive"},
|
||||||
{"umount", "(debug only) Mount a container's filesystem"},
|
{"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"},
|
{"wait", "Block until a container stops, then print its exit code"},
|
||||||
{"web", "A web UI for docker"},
|
{"web", "A web UI for docker"},
|
||||||
{"write", "Write the contents of standard input to a container's file"},
|
{"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
|
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.
|
// 'docker info': display system-wide information.
|
||||||
func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
|
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.")
|
cmd := rcli.Subcmd(stdout, "info", "", "Display system-wide information.")
|
||||||
if err := cmd.Parse(args); err != nil {
|
if err := cmd.Parse(args); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if cmd.NArg() > 1 {
|
if cmd.NArg() > 0 {
|
||||||
cmd.Usage()
|
cmd.Usage()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fmt.Fprintf(stdout, "containers: %d\nversion: %s\nimages: %d\n",
|
fmt.Fprintf(stdout, "containers: %d\nversion: %s\nimages: %d\n",
|
||||||
len(srv.containers.List()),
|
len(srv.containers.List()),
|
||||||
VERSION,
|
VERSION,
|
||||||
len(srv.images.ById))
|
imgcount)
|
||||||
return nil
|
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))
|
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]
|
id := future.RandomId()[:8]
|
||||||
container, err := srv.containers.Create(id, cmd, args, img,
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue