Exemplo n.º 1
0
func downloadRelease(version dockerversion.Version) {
	url := buildDownloadURL(version)
	binaryName := getBinaryName()
	binaryPath := filepath.Join(getVersionDir(version), binaryName)
	if version.ShouldUseArchivedRelease() {
		archivedFile := path.Join("docker", binaryName)
		downloadArchivedFileWithChecksum(url, archivedFile, binaryPath)
	} else {
		downloadFileWithChecksum(url, binaryPath)
	}
	writeDebug("Downloaded Docker %s to %s.", version, binaryPath)
}
Exemplo n.º 2
0
func buildDownloadURL(version dockerversion.Version) string {
	dockerVersion := version.SemVer.String()
	if version.IsExperimental() {
		dockerVersion = "latest"
	}

	if mirrorURL == "" {
		mirrorURL = "https://get.docker.com/builds"
		if version.IsExperimental() {
			writeDebug("Downloading from experimental builds mirror")
			mirrorURL = "https://experimental.docker.com/builds"
		}
	}

	// New Docker versions are released in a zip file, vs. the old way of releasing the client binary only
	if version.ShouldUseArchivedRelease() {
		return fmt.Sprintf("%s/%s/%s/docker-%s%s", mirrorURL, dockerOS, dockerArch, dockerVersion, archiveFileExt)
	}

	return fmt.Sprintf("%s/%s/%s/docker-%s%s", mirrorURL, dockerOS, dockerArch, dockerVersion, binaryFileExt)
}