Преглед изворни кода

Renamed docker-classic to “com.docker.com”.

Guillaume Tardif пре 5 година
родитељ
комит
bbcdad39d5

+ 4 - 4
Makefile

@@ -27,10 +27,10 @@ export DOCKER_BUILDKIT=1
 
 
 UNAME_S := $(shell uname -s)
 UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Linux)
 ifeq ($(UNAME_S),Linux)
-	CLASSIC_DOCKER=/usr/bin/docker
+	MOBY_DOCKER=/usr/bin/docker
 endif
 endif
 ifeq ($(UNAME_S),Darwin)
 ifeq ($(UNAME_S),Darwin)
-	CLASSIC_DOCKER=/Applications/Docker.app/Contents/Resources/bin/docker
+	MOBY_DOCKER=/Applications/Docker.app/Contents/Resources/bin/docker
 endif
 endif
 
 
 all: cli
 all: cli
@@ -73,8 +73,8 @@ lint: ## run linter(s)
 serve: cli ## start server
 serve: cli ## start server
 	@./bin/docker serve --address unix:///tmp/backend.sock
 	@./bin/docker serve --address unix:///tmp/backend.sock
 
 
-classic-link: ## create docker-classic symlink if does not already exist
-	ln -s $(CLASSIC_DOCKER) /usr/local/bin/docker-classic
+moby-cli-link: ## create com.docker.cli symlink if does not already exist
+	ln -s $(MOBY_DOCKER) /usr/local/bin/com.docker.cli
 
 
 help: ## Show help
 help: ## Show help
 	@echo Please specify a build target. The choices are:
 	@echo Please specify a build target. The choices are:

+ 2 - 2
README.md

@@ -16,8 +16,8 @@ If you don't have or want to use Docker for building you need to make sure you h
 
 
 And then you can call the same make targets but you need to pass it the `builder.Makefile` (`make -f builder.Makefile`).
 And then you can call the same make targets but you need to pass it the `builder.Makefile` (`make -f builder.Makefile`).
 
 
-The new CLI delegates to the classic docker for default contexts ; delegation is done to `docker-classic`. 
-* `make classic-link` will create a `docker-classic` link in `/usr/local/bin` if you don't already have it from Docker Desktop
+The new CLI delegates to the classic docker for default contexts ; delegation is done to `com.docker.cli`. 
+* `make moby-cli-link` will create a `com.docker.cli` link in `/usr/local/bin` if you don't already have it from Docker Desktop
 
 
 ## Building the project
 ## Building the project
 
 

+ 2 - 2
cli/cmd/context/create.go

@@ -32,7 +32,7 @@ import (
 
 
 	"github.com/spf13/cobra"
 	"github.com/spf13/cobra"
 
 
-	"github.com/docker/api/cli/dockerclassic"
+	"github.com/docker/api/cli/mobycli"
 	"github.com/docker/api/context/store"
 	"github.com/docker/api/context/store"
 )
 )
 
 
@@ -76,7 +76,7 @@ $ docker context create my-context --description "some description" --docker "ho
 		Use:   "create CONTEXT",
 		Use:   "create CONTEXT",
 		Short: "Create new context",
 		Short: "Create new context",
 		RunE: func(cmd *cobra.Command, args []string) error {
 		RunE: func(cmd *cobra.Command, args []string) error {
-			return dockerclassic.ExecCmd(cmd)
+			return mobycli.ExecCmd(cmd)
 		},
 		},
 		Long: longHelp,
 		Long: longHelp,
 	}
 	}

+ 2 - 2
cli/cmd/context/inspect.go

@@ -28,7 +28,7 @@
 package context
 package context
 
 
 import (
 import (
-	"github.com/docker/api/cli/dockerclassic"
+	"github.com/docker/api/cli/mobycli"
 
 
 	"github.com/spf13/cobra"
 	"github.com/spf13/cobra"
 )
 )
@@ -39,7 +39,7 @@ func inspectCommand() *cobra.Command {
 		Short: "Display detailed information on one or more contexts",
 		Short: "Display detailed information on one or more contexts",
 		Args:  cobra.ExactArgs(1),
 		Args:  cobra.ExactArgs(1),
 		RunE: func(cmd *cobra.Command, args []string) error {
 		RunE: func(cmd *cobra.Command, args []string) error {
-			return dockerclassic.ExecCmd(cmd)
+			return mobycli.ExecCmd(cmd)
 		},
 		},
 	}
 	}
 	return cmd
 	return cmd

+ 2 - 1
cli/cmd/context/rm.go

@@ -32,10 +32,11 @@ import (
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
 
 
+	"github.com/spf13/cobra"
+
 	apicontext "github.com/docker/api/context"
 	apicontext "github.com/docker/api/context"
 	"github.com/docker/api/context/store"
 	"github.com/docker/api/context/store"
 	"github.com/docker/api/multierror"
 	"github.com/docker/api/multierror"
-	"github.com/spf13/cobra"
 )
 )
 
 
 type removeOpts struct {
 type removeOpts struct {

+ 3 - 3
cli/cmd/login/login.go

@@ -8,7 +8,7 @@ import (
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
 	"github.com/spf13/cobra"
 	"github.com/spf13/cobra"
 
 
-	"github.com/docker/api/cli/dockerclassic"
+	"github.com/docker/api/cli/mobycli"
 	"github.com/docker/api/client"
 	"github.com/docker/api/client"
 	"github.com/docker/api/errdefs"
 	"github.com/docker/api/errdefs"
 )
 )
@@ -22,7 +22,7 @@ func Command() *cobra.Command {
 		Args:  cobra.MaximumNArgs(1),
 		Args:  cobra.MaximumNArgs(1),
 		RunE:  runLogin,
 		RunE:  runLogin,
 	}
 	}
-	// define flags for backward compatibility with docker-classic
+	// define flags for backward compatibility with com.docker.cli
 	flags := cmd.Flags()
 	flags := cmd.Flags()
 	flags.StringP("username", "u", "", "Username")
 	flags.StringP("username", "u", "", "Username")
 	flags.StringP("password", "p", "", "Password")
 	flags.StringP("password", "p", "", "Password")
@@ -41,7 +41,7 @@ func runLogin(cmd *cobra.Command, args []string) error {
 			return errors.New("unknown backend type for cloud login: " + backend)
 			return errors.New("unknown backend type for cloud login: " + backend)
 		}
 		}
 	}
 	}
-	return dockerclassic.ExecCmd(cmd)
+	return mobycli.ExecCmd(cmd)
 }
 }
 
 
 func cloudLogin(cmd *cobra.Command, backendType string) error {
 func cloudLogin(cmd *cobra.Command, backendType string) error {

+ 4 - 4
cli/cmd/version.go

@@ -6,7 +6,7 @@ import (
 
 
 	"github.com/spf13/cobra"
 	"github.com/spf13/cobra"
 
 
-	"github.com/docker/api/cli/dockerclassic"
+	"github.com/docker/api/cli/mobycli"
 )
 )
 
 
 const cliVersion = "0.1.0"
 const cliVersion = "0.1.0"
@@ -19,7 +19,7 @@ func VersionCommand() *cobra.Command {
 		Args:  cobra.MaximumNArgs(0),
 		Args:  cobra.MaximumNArgs(0),
 		RunE:  runVersion,
 		RunE:  runVersion,
 	}
 	}
-	// define flags for backward compatibility with docker-classic
+	// define flags for backward compatibility with com.docker.cli
 	flags := cmd.Flags()
 	flags := cmd.Flags()
 	flags.String("format", "", "Format the output using the given Go template")
 	flags.String("format", "", "Format the output using the given Go template")
 	flags.String("kubeconfig", "", "Kubernetes config file")
 	flags.String("kubeconfig", "", "Kubernetes config file")
@@ -28,11 +28,11 @@ func VersionCommand() *cobra.Command {
 }
 }
 
 
 func runVersion(cmd *cobra.Command, args []string) error {
 func runVersion(cmd *cobra.Command, args []string) error {
-	versionResult, _ := dockerclassic.ExecSilent(cmd.Context())
+	versionResult, _ := mobycli.ExecSilent(cmd.Context())
 	// we don't want to fail on error, there is an error if the engine is not available but it displays client version info
 	// we don't want to fail on error, there is an error if the engine is not available but it displays client version info
 	// Still, technically the [] byte versionResult could be nil, just let the original command display what it has to display
 	// Still, technically the [] byte versionResult could be nil, just let the original command display what it has to display
 	if versionResult == nil {
 	if versionResult == nil {
-		return dockerclassic.ExecCmd(cmd)
+		return mobycli.ExecCmd(cmd)
 	}
 	}
 	var s string = string(versionResult)
 	var s string = string(versionResult)
 	fmt.Print(strings.Replace(s, "\n Version:", "\n Azure integration  "+cliVersion+"\n Version:", 1))
 	fmt.Print(strings.Replace(s, "\n Version:", "\n Azure integration  "+cliVersion+"\n Version:", 1))

+ 5 - 5
cli/main.go

@@ -52,7 +52,7 @@ import (
 	contextcmd "github.com/docker/api/cli/cmd/context"
 	contextcmd "github.com/docker/api/cli/cmd/context"
 	"github.com/docker/api/cli/cmd/login"
 	"github.com/docker/api/cli/cmd/login"
 	"github.com/docker/api/cli/cmd/run"
 	"github.com/docker/api/cli/cmd/run"
-	"github.com/docker/api/cli/dockerclassic"
+	"github.com/docker/api/cli/mobycli"
 	cliopts "github.com/docker/api/cli/options"
 	cliopts "github.com/docker/api/cli/options"
 	"github.com/docker/api/config"
 	"github.com/docker/api/config"
 	apicontext "github.com/docker/api/context"
 	apicontext "github.com/docker/api/context"
@@ -101,7 +101,7 @@ func main() {
 		SilenceUsage:  true,
 		SilenceUsage:  true,
 		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
 		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
 			if !isOwnCommand(cmd) {
 			if !isOwnCommand(cmd) {
-				dockerclassic.Exec(cmd.Context())
+				mobycli.Exec(cmd.Context())
 			}
 			}
 			return nil
 			return nil
 		},
 		},
@@ -127,7 +127,7 @@ func main() {
 	helpFunc := root.HelpFunc()
 	helpFunc := root.HelpFunc()
 	root.SetHelpFunc(func(cmd *cobra.Command, args []string) {
 	root.SetHelpFunc(func(cmd *cobra.Command, args []string) {
 		if !isOwnCommand(cmd) {
 		if !isOwnCommand(cmd) {
-			dockerclassic.Exec(cmd.Context())
+			mobycli.Exec(cmd.Context())
 		}
 		}
 		helpFunc(cmd, args)
 		helpFunc(cmd, args)
 	})
 	})
@@ -168,7 +168,7 @@ func main() {
 			fmt.Fprintln(os.Stderr, err)
 			fmt.Fprintln(os.Stderr, err)
 			os.Exit(1)
 			os.Exit(1)
 		}
 		}
-		dockerclassic.Exec(ctx)
+		mobycli.Exec(ctx)
 
 
 		checkIfUnknownCommandExistInDefaultContext(err, currentContext)
 		checkIfUnknownCommandExistInDefaultContext(err, currentContext)
 		fmt.Fprintln(os.Stderr, err)
 		fmt.Fprintln(os.Stderr, err)
@@ -182,7 +182,7 @@ func checkIfUnknownCommandExistInDefaultContext(err error, currentContext string
 	if len(submatch) == 2 {
 	if len(submatch) == 2 {
 		dockerCommand := string(submatch[1])
 		dockerCommand := string(submatch[1])
 
 
-		if dockerclassic.IsDefaultContextCommand(dockerCommand) {
+		if mobycli.IsDefaultContextCommand(dockerCommand) {
 			fmt.Fprintf(os.Stderr, "Command \"%s\" not available in current context (%s), you can use the \"default\" context to run this command\n", dockerCommand, currentContext)
 			fmt.Fprintf(os.Stderr, "Command \"%s\" not available in current context (%s), you can use the \"default\" context to run this command\n", dockerCommand, currentContext)
 			os.Exit(1)
 			os.Exit(1)
 		}
 		}

+ 8 - 8
cli/dockerclassic/exec.go → cli/mobycli/exec.go

@@ -1,4 +1,4 @@
-package dockerclassic
+package mobycli
 
 
 import (
 import (
 	"context"
 	"context"
@@ -13,10 +13,10 @@ import (
 	"github.com/docker/api/context/store"
 	"github.com/docker/api/context/store"
 )
 )
 
 
-// ClassicCliName name of the classic cli binary
-const ClassicCliName = "docker-classic"
+// ComDockerCli name of the classic cli binary
+const ComDockerCli = "com.docker.cli"
 
 
-// Exec delegates to docker-classic
+// Exec delegates to com.docker.cli
 func Exec(ctx context.Context) {
 func Exec(ctx context.Context) {
 	currentContext := apicontext.CurrentContext(ctx)
 	currentContext := apicontext.CurrentContext(ctx)
 	s := store.ContextStore(ctx)
 	s := store.ContextStore(ctx)
@@ -25,7 +25,7 @@ func Exec(ctx context.Context) {
 	// Only run original docker command if the current context is not
 	// Only run original docker command if the current context is not
 	// ours.
 	// ours.
 	if err != nil {
 	if err != nil {
-		cmd := exec.CommandContext(ctx, ClassicCliName, os.Args[1:]...)
+		cmd := exec.CommandContext(ctx, ComDockerCli, os.Args[1:]...)
 		cmd.Stdin = os.Stdin
 		cmd.Stdin = os.Stdin
 		cmd.Stdout = os.Stdout
 		cmd.Stdout = os.Stdout
 		cmd.Stderr = os.Stderr
 		cmd.Stderr = os.Stderr
@@ -40,7 +40,7 @@ func Exec(ctx context.Context) {
 	}
 	}
 }
 }
 
 
-// ExecCmd delegates the cli command to docker-classic. The error is never returned (process will exit with docker classic exit code), the return type is to make it easier to use with cobra commands
+// ExecCmd delegates the cli command to com.docker.cli. The error is never returned (process will exit with docker classic exit code), the return type is to make it easier to use with cobra commands
 func ExecCmd(command *cobra.Command) error {
 func ExecCmd(command *cobra.Command) error {
 	Exec(command.Context())
 	Exec(command.Context())
 	return nil
 	return nil
@@ -48,7 +48,7 @@ func ExecCmd(command *cobra.Command) error {
 
 
 // IsDefaultContextCommand checks if the command exists in the classic cli (issues a shellout --help)
 // IsDefaultContextCommand checks if the command exists in the classic cli (issues a shellout --help)
 func IsDefaultContextCommand(dockerCommand string) bool {
 func IsDefaultContextCommand(dockerCommand string) bool {
-	cmd := exec.Command(ClassicCliName, dockerCommand, "--help")
+	cmd := exec.Command(ComDockerCli, dockerCommand, "--help")
 	b, e := cmd.CombinedOutput()
 	b, e := cmd.CombinedOutput()
 	if e != nil {
 	if e != nil {
 		fmt.Println(e)
 		fmt.Println(e)
@@ -60,6 +60,6 @@ func IsDefaultContextCommand(dockerCommand string) bool {
 
 
 // ExecSilent executes a command and do redirect output to stdOut, return output
 // ExecSilent executes a command and do redirect output to stdOut, return output
 func ExecSilent(ctx context.Context) ([]byte, error) {
 func ExecSilent(ctx context.Context) ([]byte, error) {
-	cmd := exec.CommandContext(ctx, ClassicCliName, os.Args[1:]...)
+	cmd := exec.CommandContext(ctx, ComDockerCli, os.Args[1:]...)
 	return cmd.CombinedOutput()
 	return cmd.CombinedOutput()
 }
 }

+ 1 - 1
cli/dockerclassic/job_windows.go → cli/mobycli/job_windows.go

@@ -1,4 +1,4 @@
-package dockerclassic
+package mobycli
 
 
 import (
 import (
 	"fmt"
 	"fmt"

+ 1 - 1
context/store/storedefault.go

@@ -35,7 +35,7 @@ type endpoint struct {
 
 
 func dockerDefaultContext() (*DockerContext, error) {
 func dockerDefaultContext() (*DockerContext, error) {
 	// ensure we run this using default context, in current context has been damaged / removed in store
 	// ensure we run this using default context, in current context has been damaged / removed in store
-	cmd := exec.Command("docker-classic", "--context", "default", "context", "inspect", "default")
+	cmd := exec.Command("com.docker.cli", "--context", "default", "context", "inspect", "default")
 	var stdout bytes.Buffer
 	var stdout bytes.Buffer
 	cmd.Stdout = &stdout
 	cmd.Stdout = &stdout
 	err := cmd.Run()
 	err := cmd.Run()

+ 3 - 2
protos/compose/v1/compose.pb.go

@@ -34,14 +34,15 @@ package v1
 
 
 import (
 import (
 	context "context"
 	context "context"
+	reflect "reflect"
+	sync "sync"
+
 	proto "github.com/golang/protobuf/proto"
 	proto "github.com/golang/protobuf/proto"
 	grpc "google.golang.org/grpc"
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
 	status "google.golang.org/grpc/status"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
 )
 )
 
 
 const (
 const (

+ 3 - 2
protos/containers/v1/containers.pb.go

@@ -34,14 +34,15 @@ package v1
 
 
 import (
 import (
 	context "context"
 	context "context"
+	reflect "reflect"
+	sync "sync"
+
 	proto "github.com/golang/protobuf/proto"
 	proto "github.com/golang/protobuf/proto"
 	grpc "google.golang.org/grpc"
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
 	status "google.golang.org/grpc/status"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
 )
 )
 
 
 const (
 const (

+ 3 - 2
protos/contexts/v1/contexts.pb.go

@@ -34,14 +34,15 @@ package v1
 
 
 import (
 import (
 	context "context"
 	context "context"
+	reflect "reflect"
+	sync "sync"
+
 	proto "github.com/golang/protobuf/proto"
 	proto "github.com/golang/protobuf/proto"
 	grpc "google.golang.org/grpc"
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
 	status "google.golang.org/grpc/status"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
 )
 )
 
 
 const (
 const (

+ 3 - 2
protos/streams/v1/streams.pb.go

@@ -8,6 +8,9 @@ package v1
 
 
 import (
 import (
 	context "context"
 	context "context"
+	reflect "reflect"
+	sync "sync"
+
 	proto "github.com/golang/protobuf/proto"
 	proto "github.com/golang/protobuf/proto"
 	any "github.com/golang/protobuf/ptypes/any"
 	any "github.com/golang/protobuf/ptypes/any"
 	grpc "google.golang.org/grpc"
 	grpc "google.golang.org/grpc"
@@ -15,8 +18,6 @@ import (
 	status "google.golang.org/grpc/status"
 	status "google.golang.org/grpc/status"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
 )
 )
 
 
 const (
 const (

+ 2 - 2
tests/e2e/e2e_test.go

@@ -121,13 +121,13 @@ func (s *E2eSuite) TestCloudLogin() {
 }
 }
 
 
 func (s *E2eSuite) TestSetupError() {
 func (s *E2eSuite) TestSetupError() {
-	It("should display an error if cannot shell out to docker-classic", func() {
+	It("should display an error if cannot shell out to com.docker.cli", func() {
 		err := os.Setenv("PATH", s.BinDir)
 		err := os.Setenv("PATH", s.BinDir)
 		Expect(err).To(BeNil())
 		Expect(err).To(BeNil())
 		err = os.Remove(filepath.Join(s.BinDir, DockerClassicExecutable()))
 		err = os.Remove(filepath.Join(s.BinDir, DockerClassicExecutable()))
 		Expect(err).To(BeNil())
 		Expect(err).To(BeNil())
 		output, err := s.NewDockerCommand("ps").Exec()
 		output, err := s.NewDockerCommand("ps").Exec()
-		Expect(output).To(ContainSubstring("docker-classic"))
+		Expect(output).To(ContainSubstring("com.docker.cli"))
 		Expect(output).To(ContainSubstring("not found"))
 		Expect(output).To(ContainSubstring("not found"))
 		Expect(err).NotTo(BeNil())
 		Expect(err).NotTo(BeNil())
 	})
 	})

+ 4 - 2
tests/framework/suite.go

@@ -35,6 +35,8 @@ import (
 	"path/filepath"
 	"path/filepath"
 	"time"
 	"time"
 
 
+	"github.com/docker/api/cli/mobycli"
+
 	"github.com/onsi/gomega"
 	"github.com/onsi/gomega"
 	log "github.com/sirupsen/logrus"
 	log "github.com/sirupsen/logrus"
 	"github.com/stretchr/testify/suite"
 	"github.com/stretchr/testify/suite"
@@ -154,9 +156,9 @@ func dockerExecutable() string {
 // DockerClassicExecutable binary name based on platform
 // DockerClassicExecutable binary name based on platform
 func DockerClassicExecutable() string {
 func DockerClassicExecutable() string {
 	if IsWindows() {
 	if IsWindows() {
-		return "docker-classic.exe"
+		return mobycli.ComDockerCli + ".exe"
 	}
 	}
-	return "docker-classic"
+	return mobycli.ComDockerCli
 }
 }
 
 
 // NewDockerCommand creates a docker builder.
 // NewDockerCommand creates a docker builder.

+ 1 - 1
tests/skip-win-ci-e2e/skip_win_ci_test.go

@@ -46,7 +46,7 @@ type NonWinCIE2eSuite struct {
 }
 }
 
 
 func (s *NonWinCIE2eSuite) TestKillChildOnCancel() {
 func (s *NonWinCIE2eSuite) TestKillChildOnCancel() {
-	It("should kill docker-classic if parent command is cancelled", func() {
+	It("should kill com.docker.cli if parent command is cancelled", func() {
 		imageName := "test-sleep-image"
 		imageName := "test-sleep-image"
 		out := s.ListProcessesCommand().ExecOrDie()
 		out := s.ListProcessesCommand().ExecOrDie()
 		Expect(out).NotTo(ContainSubstring(imageName))
 		Expect(out).NotTo(ContainSubstring(imageName))