forked from docker/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build two binaries client and daemon.
Add a proxy to support 'docker daemon' Fix configFile option, and remove a test that is no longer relevant. Remove daemon build tag. Remove DOCKER_CLIENTONLY from build scripts. Signed-off-by: Daniel Nephin <[email protected]> Change docker-daemon to dockerd. Signed-off-by: Daniel Nephin <[email protected]>
- Loading branch information
Showing
37 changed files
with
412 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"syscall" | ||
) | ||
|
||
const daemonBinary = "dockerd" | ||
|
||
// DaemonProxy acts as a cli.Handler to proxy calls to the daemon binary | ||
type DaemonProxy struct{} | ||
|
||
// NewDaemonProxy returns a new handler | ||
func NewDaemonProxy() DaemonProxy { | ||
return DaemonProxy{} | ||
} | ||
|
||
// CmdDaemon execs dockerd with the same flags | ||
// TODO: add a deprecation warning? | ||
func (p DaemonProxy) CmdDaemon(args ...string) error { | ||
args = stripDaemonArg(os.Args[1:]) | ||
|
||
binaryAbsPath, err := exec.LookPath(daemonBinary) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return syscall.Exec( | ||
binaryAbsPath, | ||
append([]string{daemonBinary}, args...), | ||
os.Environ()) | ||
} | ||
|
||
// stripDaemonArg removes the `daemon` argument from the list | ||
func stripDaemonArg(args []string) []string { | ||
for i, arg := range args { | ||
if arg == "daemon" { | ||
return append(args[:i], args[i+1:]...) | ||
} | ||
} | ||
return args | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/Sirupsen/logrus" | ||
"github.com/docker/docker/api/client" | ||
"github.com/docker/docker/cli" | ||
"github.com/docker/docker/dockerversion" | ||
flag "github.com/docker/docker/pkg/mflag" | ||
"github.com/docker/docker/pkg/reexec" | ||
"github.com/docker/docker/pkg/term" | ||
"github.com/docker/docker/utils" | ||
) | ||
|
||
func main() { | ||
if reexec.Init() { | ||
return | ||
} | ||
|
||
// Set terminal emulation based on platform as required. | ||
stdin, stdout, stderr := term.StdStreams() | ||
|
||
logrus.SetOutput(stderr) | ||
|
||
flag.Merge(flag.CommandLine, clientFlags.FlagSet, commonFlags.FlagSet) | ||
|
||
flag.Usage = func() { | ||
fmt.Fprint(stdout, "Usage: docker [OPTIONS] COMMAND [arg...]\n docker [ --help | -v | --version ]\n\n") | ||
fmt.Fprint(stdout, "A self-sufficient runtime for containers.\n\nOptions:\n") | ||
|
||
flag.CommandLine.SetOutput(stdout) | ||
flag.PrintDefaults() | ||
|
||
help := "\nCommands:\n" | ||
|
||
for _, cmd := range dockerCommands { | ||
help += fmt.Sprintf(" %-10.10s%s\n", cmd.Name, cmd.Description) | ||
} | ||
|
||
help += "\nRun 'docker COMMAND --help' for more information on a command." | ||
fmt.Fprintf(stdout, "%s\n", help) | ||
} | ||
|
||
flag.Parse() | ||
|
||
if *flVersion { | ||
showVersion() | ||
return | ||
} | ||
|
||
if *flHelp { | ||
// if global flag --help is present, regardless of what other options and commands there are, | ||
// just print the usage. | ||
flag.Usage() | ||
return | ||
} | ||
|
||
clientCli := client.NewDockerCli(stdin, stdout, stderr, clientFlags) | ||
|
||
c := cli.New(clientCli, NewDaemonProxy()) | ||
if err := c.Run(flag.Args()...); err != nil { | ||
if sterr, ok := err.(cli.StatusError); ok { | ||
if sterr.Status != "" { | ||
fmt.Fprintln(stderr, sterr.Status) | ||
os.Exit(1) | ||
} | ||
os.Exit(sterr.StatusCode) | ||
} | ||
fmt.Fprintln(stderr, err) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func showVersion() { | ||
if utils.ExperimentalBuild() { | ||
fmt.Printf("Docker version %s, build %s, experimental\n", dockerversion.Version, dockerversion.GitCommit) | ||
} else { | ||
fmt.Printf("Docker version %s, build %s\n", dockerversion.Version, dockerversion.GitCommit) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package main | ||
|
||
import ( | ||
_ "github.com/docker/docker/autogen/winresources" | ||
) |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.