mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Move commands into docker
This commit is contained in:
parent
b97f9e8148
commit
e5e66716df
2 changed files with 9 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
package commands
|
||||
package docker
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
@ -6,7 +6,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker"
|
||||
"github.com/dotcloud/docker/fs"
|
||||
"github.com/dotcloud/docker/future"
|
||||
"github.com/dotcloud/docker/rcli"
|
||||
|
@ -550,7 +549,7 @@ func (srv *Server) CmdPs(stdin io.ReadCloser, stdout io.Writer, args ...string)
|
|||
if !*quiet {
|
||||
command := fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " "))
|
||||
if !*fl_full {
|
||||
command = docker.Trunc(command, 20)
|
||||
command = Trunc(command, 20)
|
||||
}
|
||||
for idx, field := range []string{
|
||||
/* ID */ container.Id,
|
||||
|
@ -741,10 +740,10 @@ 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, memory int64, 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) (*Container, error) {
|
||||
id := future.RandomId()[:8]
|
||||
container, err := srv.containers.Create(id, cmd, args, img,
|
||||
&docker.Config{
|
||||
&Config{
|
||||
Hostname: id,
|
||||
Ports: ports,
|
||||
User: user,
|
||||
|
@ -945,12 +944,12 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string)
|
|||
return nil
|
||||
}
|
||||
|
||||
func New() (*Server, error) {
|
||||
func NewServer() (*Server, error) {
|
||||
future.Seed()
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
containers, err := docker.New()
|
||||
containers, err := New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1001,6 +1000,6 @@ func (srv *Server) CmdWeb(stdin io.ReadCloser, stdout io.Writer, args ...string)
|
|||
}
|
||||
|
||||
type Server struct {
|
||||
containers *docker.Docker
|
||||
containers *Docker
|
||||
images *fs.Store
|
||||
}
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"github.com/dotcloud/docker"
|
||||
"github.com/dotcloud/docker/commands"
|
||||
"github.com/dotcloud/docker/future"
|
||||
"github.com/dotcloud/docker/rcli"
|
||||
"github.com/dotcloud/docker/term"
|
||||
|
@ -36,7 +35,7 @@ func main() {
|
|||
}
|
||||
|
||||
func daemon() error {
|
||||
service, err := commands.New()
|
||||
service, err := docker.NewServer()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -78,7 +77,7 @@ func runCommand(args []string) error {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
service, err := commands.New()
|
||||
service, err := docker.NewServer()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue