Solomon Hykes vor 12 Jahren
Ursprung
Commit
86854ffbc5
13 geänderte Dateien mit 43 neuen und 24 gelöschten Zeilen
  1. 2 2
      client/client.go
  2. 1 1
      container.go
  3. 1 1
      container_test.go
  4. 1 1
      docker.go
  5. 1 1
      docker/docker.go
  6. 1 1
      docker_test.go
  7. 2 2
      dockerd/dockerd.go
  8. 1 1
      fs/layers.go
  9. 1 1
      fs/layers_test.go
  10. 1 1
      fs/store.go
  11. 1 1
      fs/store_test.go
  12. 29 10
      server/server.go
  13. 1 1
      state.go

+ 2 - 2
client/client.go

@@ -1,8 +1,8 @@
 package client
 
 import (
-	"../future"
-	"../rcli"
+	"github.com/dotcloud/docker/future"
+	"github.com/dotcloud/docker/rcli"
 	"io"
 	"log"
 	"os"

+ 1 - 1
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"

+ 1 - 1
container_test.go

@@ -1,9 +1,9 @@
 package docker
 
 import (
-	"./fs"
 	"bufio"
 	"fmt"
+	"github.com/dotcloud/docker/fs"
 	"io"
 	"io/ioutil"
 	"math/rand"

+ 1 - 1
docker.go

@@ -1,9 +1,9 @@
 package docker
 
 import (
-	"./fs"
 	"container/list"
 	"fmt"
+	"github.com/dotcloud/docker/fs"
 	"io/ioutil"
 	"log"
 	"os"

+ 1 - 1
docker/docker.go

@@ -1,7 +1,7 @@
 package main
 
 import (
-	"../client"
+	"github.com/dotcloud/docker/client"
 	"log"
 	"os"
 )

+ 1 - 1
docker_test.go

@@ -1,7 +1,7 @@
 package docker
 
 import (
-	"./fs"
+	"github.com/dotcloud/docker/fs"
 	"io"
 	"io/ioutil"
 	"log"

+ 2 - 2
dockerd/dockerd.go

@@ -1,9 +1,9 @@
 package main
 
 import (
-	".."
-	"../server"
 	"flag"
+	"github.com/dotcloud/docker"
+	"github.com/dotcloud/docker/server"
 	"log"
 )
 

+ 1 - 1
fs/layers.go

@@ -1,9 +1,9 @@
 package fs
 
 import (
-	"../future"
 	"errors"
 	"fmt"
+	"github.com/dotcloud/docker/future"
 	"io"
 	"io/ioutil"
 	"os"

+ 1 - 1
fs/layers_test.go

@@ -1,7 +1,7 @@
 package fs
 
 import (
-	"../fake"
+	"github.com/dotcloud/docker/fake"
 	"io/ioutil"
 	"os"
 	"testing"

+ 1 - 1
fs/store.go

@@ -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 - 1
fs/store_test.go

@@ -1,9 +1,9 @@
 package fs
 
 import (
-	"../fake"
 	"errors"
 	"fmt"
+	"github.com/dotcloud/docker/fake"
 	"io/ioutil"
 	"os"
 	"testing"

+ 29 - 10
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"
@@ -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
 	}

+ 1 - 1
state.go

@@ -1,8 +1,8 @@
 package docker
 
 import (
-	"./future"
 	"fmt"
+	"github.com/dotcloud/docker/future"
 	"sync"
 	"time"
 )