mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merged master
This commit is contained in:
commit
86854ffbc5
13 changed files with 43 additions and 24 deletions
|
@ -1,8 +1,8 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"../future"
|
||||
"../rcli"
|
||||
"github.com/dotcloud/docker/future"
|
||||
"github.com/dotcloud/docker/rcli"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"./fs"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/dotcloud/docker/fs"
|
||||
"github.com/kr/pty"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"./fs"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/fs"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"./fs"
|
||||
"container/list"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/fs"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"../client"
|
||||
"github.com/dotcloud/docker/client"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"./fs"
|
||||
"github.com/dotcloud/docker/fs"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
".."
|
||||
"../server"
|
||||
"flag"
|
||||
"github.com/dotcloud/docker"
|
||||
"github.com/dotcloud/docker/server"
|
||||
"log"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"../future"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/future"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"../fake"
|
||||
"github.com/dotcloud/docker/fake"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"../fake"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/fake"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
2
state.go
2
state.go
|
@ -1,8 +1,8 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"./future"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/future"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue