// loginRegistry calls the `docker login` command to authenticate the engine to the
// specified registry with given credentials.
func loginRegistry(s dockerLoginSettings) error {
	if !s.HasLoginInfo() {
		log.Println("registry login not specificied")
		return nil
	}
	opts := []string{
		"login",
		"--email=" + s.Email,
		"--username="******"--password="******"" {
		opts = append(opts, s.Server)
	}
	return executil.ExecPipe("docker", opts...)
}
func (d systemdBaseDriver) RestartDocker() error {
	if err := executil.ExecPipe("systemctl", "daemon-reload"); err != nil {
		return err
	}
	return executil.ExecPipe("systemctl", "restart", "docker")
}
func (d systemdBaseDriver) StopDocker() error {
	return executil.ExecPipe("systemctl", "stop", "docker")
}
func (c CentOSDriver) UninstallDocker() error {
	return executil.ExecPipe("yum", "-y", "-q", "remove", "docker-engine.x86_64")
}
func (c CentOSDriver) InstallDocker() error {
	return executil.ExecPipe("/bin/sh", "-c", "curl -sSL https://get.docker.com/ | sh")
}
func (d upstartBaseDriver) RestartDocker() error {
	if err := executil.ExecPipe("update-rc.d", "docker", "defaults"); err != nil {
		return err
	}
	return executil.ExecPipe("service", "docker", "restart")
}
func (d upstartBaseDriver) StopDocker() error {
	return executil.ExecPipe("service", "docker", "stop")
}
func (u ubuntuBaseDriver) InstallDocker() error {
	return executil.ExecPipe("/bin/sh", "-c", "wget -qO- https://get.docker.com/ | sh")
}
func (u ubuntuBaseDriver) UninstallDocker() error {
	if err := executil.ExecPipe("apt-get", "-qqy", "purge", "docker-engine"); err != nil {
		return err
	}
	return executil.ExecPipe("apt-get", "-qqy", "autoremove")
}