mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
dockerversion placeholder for library import
- Add a *version* file placeholder. - Update autogen and builds to use it and an autogen build flag Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -22,6 +22,7 @@ bin
|
|||||||
build_src
|
build_src
|
||||||
bundles/
|
bundles/
|
||||||
docker/docker
|
docker/docker
|
||||||
|
dockerversion/version_autogen.go
|
||||||
docs/AWS_S3_BUCKET
|
docs/AWS_S3_BUCKET
|
||||||
docs/GITCOMMIT
|
docs/GITCOMMIT
|
||||||
docs/GIT_BRANCH
|
docs/GIT_BRANCH
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/stdcopy"
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
"github.com/docker/docker/pkg/term"
|
"github.com/docker/docker/pkg/term"
|
||||||
)
|
)
|
||||||
@@ -152,7 +152,7 @@ func (cli *DockerCli) hijackWithContentType(method, path, contentType string, se
|
|||||||
req.Header.Set(k, v)
|
req.Header.Set(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.VERSION+" ("+runtime.GOOS+")")
|
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.Version+" ("+runtime.GOOS+")")
|
||||||
req.Header.Set("Content-Type", contentType)
|
req.Header.Set("Content-Type", contentType)
|
||||||
req.Header.Set("Connection", "Upgrade")
|
req.Header.Set("Connection", "Upgrade")
|
||||||
req.Header.Set("Upgrade", "tcp")
|
req.Header.Set("Upgrade", "tcp")
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import (
|
|||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/cliconfig"
|
"github.com/docker/docker/cliconfig"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/jsonmessage"
|
"github.com/docker/docker/pkg/jsonmessage"
|
||||||
"github.com/docker/docker/pkg/signal"
|
"github.com/docker/docker/pkg/signal"
|
||||||
"github.com/docker/docker/pkg/stdcopy"
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
@@ -77,7 +77,7 @@ func (cli *DockerCli) clientRequest(method, path string, in io.Reader, headers m
|
|||||||
req.Header.Set(k, v)
|
req.Header.Set(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.VERSION+" ("+runtime.GOOS+")")
|
req.Header.Set("User-Agent", "Docker-Client/"+dockerversion.Version+" ("+runtime.GOOS+")")
|
||||||
req.URL.Host = cli.addr
|
req.URL.Host = cli.addr
|
||||||
req.URL.Scheme = cli.scheme
|
req.URL.Scheme = cli.scheme
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/docker/utils"
|
"github.com/docker/docker/utils"
|
||||||
)
|
)
|
||||||
@@ -60,11 +60,11 @@ func (cli *DockerCli) CmdVersion(args ...string) (err error) {
|
|||||||
|
|
||||||
vd := versionData{
|
vd := versionData{
|
||||||
Client: types.Version{
|
Client: types.Version{
|
||||||
Version: dockerversion.VERSION,
|
Version: dockerversion.Version,
|
||||||
APIVersion: api.Version,
|
APIVersion: api.Version,
|
||||||
GoVersion: runtime.Version(),
|
GoVersion: runtime.Version(),
|
||||||
GitCommit: dockerversion.GITCOMMIT,
|
GitCommit: dockerversion.GitCommit,
|
||||||
BuildTime: dockerversion.BUILDTIME,
|
BuildTime: dockerversion.BuildTime,
|
||||||
Os: runtime.GOOS,
|
Os: runtime.GOOS,
|
||||||
Arch: runtime.GOARCH,
|
Arch: runtime.GOARCH,
|
||||||
Experimental: utils.ExperimentalBuild(),
|
Experimental: utils.ExperimentalBuild(),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/server/httputils"
|
"github.com/docker/docker/api/server/httputils"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/errors"
|
"github.com/docker/docker/errors"
|
||||||
"github.com/docker/docker/pkg/version"
|
"github.com/docker/docker/pkg/version"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
@@ -111,7 +111,7 @@ func versionMiddleware(handler httputils.APIFunc) httputils.APIFunc {
|
|||||||
return errors.ErrorCodeOldClientVersion.WithArgs(apiVersion, api.Version)
|
return errors.ErrorCodeOldClientVersion.WithArgs(apiVersion, api.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Server", "Docker/"+dockerversion.VERSION+" ("+runtime.GOOS+")")
|
w.Header().Set("Server", "Docker/"+dockerversion.Version+" ("+runtime.GOOS+")")
|
||||||
ctx = context.WithValue(ctx, httputils.APIVersionKey, apiVersion)
|
ctx = context.WithValue(ctx, httputils.APIVersionKey, apiVersion)
|
||||||
return handler(ctx, w, r, vars)
|
return handler(ctx, w, r, vars)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/server/httputils"
|
"github.com/docker/docker/api/server/httputils"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
"github.com/docker/docker/pkg/jsonmessage"
|
"github.com/docker/docker/pkg/jsonmessage"
|
||||||
"github.com/docker/docker/pkg/parsers/filters"
|
"github.com/docker/docker/pkg/parsers/filters"
|
||||||
@@ -21,13 +21,13 @@ import (
|
|||||||
|
|
||||||
func (s *router) getVersion(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
func (s *router) getVersion(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||||
v := &types.Version{
|
v := &types.Version{
|
||||||
Version: dockerversion.VERSION,
|
Version: dockerversion.Version,
|
||||||
APIVersion: api.Version,
|
APIVersion: api.Version,
|
||||||
GitCommit: dockerversion.GITCOMMIT,
|
GitCommit: dockerversion.GitCommit,
|
||||||
GoVersion: runtime.Version(),
|
GoVersion: runtime.Version(),
|
||||||
Os: runtime.GOOS,
|
Os: runtime.GOOS,
|
||||||
Arch: runtime.GOARCH,
|
Arch: runtime.GOARCH,
|
||||||
BuildTime: dockerversion.BUILDTIME,
|
BuildTime: dockerversion.BuildTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
version := httputils.VersionFromContext(ctx)
|
version := httputils.VersionFromContext(ctx)
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
derr "github.com/docker/docker/errors"
|
derr "github.com/docker/docker/errors"
|
||||||
"github.com/docker/docker/pkg/fileutils"
|
"github.com/docker/docker/pkg/fileutils"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
@@ -283,7 +283,7 @@ func migrateIfDownlevel(driver graphdriver.Driver, root string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func configureSysInit(config *Config, rootUID, rootGID int) (string, error) {
|
func configureSysInit(config *Config, rootUID, rootGID int) (string, error) {
|
||||||
localCopy := filepath.Join(config.Root, "init", fmt.Sprintf("dockerinit-%s", dockerversion.VERSION))
|
localCopy := filepath.Join(config.Root, "init", fmt.Sprintf("dockerinit-%s", dockerversion.Version))
|
||||||
sysInitPath := utils.DockerInitPath(localCopy)
|
sysInitPath := utils.DockerInitPath(localCopy)
|
||||||
if sysInitPath == "" {
|
if sysInitPath == "" {
|
||||||
return "", fmt.Errorf("Could not locate dockerinit: This usually means docker was built incorrectly. See https://docs.docker.com/project/set-up-dev-env/ for official build instructions.")
|
return "", fmt.Errorf("Could not locate dockerinit: This usually means docker was built incorrectly. See https://docs.docker.com/project/set-up-dev-env/ for official build instructions.")
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/daemon/execdriver"
|
"github.com/docker/docker/daemon/execdriver"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/parsers"
|
"github.com/docker/docker/pkg/parsers"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ var forceKill bool
|
|||||||
// Define name and version for windows
|
// Define name and version for windows
|
||||||
var (
|
var (
|
||||||
DriverName = "Windows 1854"
|
DriverName = "Windows 1854"
|
||||||
Version = dockerversion.VERSION + " " + dockerversion.GITCOMMIT
|
Version = dockerversion.Version + " " + dockerversion.GitCommit
|
||||||
)
|
)
|
||||||
|
|
||||||
type activeContainer struct {
|
type activeContainer struct {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/chrootarchive"
|
"github.com/docker/docker/pkg/chrootarchive"
|
||||||
@@ -440,7 +440,7 @@ func (d *Driver) RestoreCustomImages(tagger graphdriver.Tagger, recorder graphdr
|
|||||||
img := &image.Image{
|
img := &image.Image{
|
||||||
ID: id,
|
ID: id,
|
||||||
Created: imageData.CreatedTime,
|
Created: imageData.CreatedTime,
|
||||||
DockerVersion: dockerversion.VERSION,
|
DockerVersion: dockerversion.Version,
|
||||||
Architecture: runtime.GOARCH,
|
Architecture: runtime.GOARCH,
|
||||||
OS: runtime.GOOS,
|
OS: runtime.GOOS,
|
||||||
Size: imageData.Size,
|
Size: imageData.Size,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/fileutils"
|
"github.com/docker/docker/pkg/fileutils"
|
||||||
"github.com/docker/docker/pkg/parsers/kernel"
|
"github.com/docker/docker/pkg/parsers/kernel"
|
||||||
"github.com/docker/docker/pkg/parsers/operatingsystem"
|
"github.com/docker/docker/pkg/parsers/operatingsystem"
|
||||||
@@ -83,14 +83,14 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|||||||
OperatingSystem: operatingSystem,
|
OperatingSystem: operatingSystem,
|
||||||
IndexServerAddress: registry.IndexServer,
|
IndexServerAddress: registry.IndexServer,
|
||||||
RegistryConfig: daemon.RegistryService.Config,
|
RegistryConfig: daemon.RegistryService.Config,
|
||||||
InitSha1: dockerversion.INITSHA1,
|
InitSha1: dockerversion.InitSHA1,
|
||||||
InitPath: initPath,
|
InitPath: initPath,
|
||||||
NCPU: runtime.NumCPU(),
|
NCPU: runtime.NumCPU(),
|
||||||
MemTotal: meminfo.MemTotal,
|
MemTotal: meminfo.MemTotal,
|
||||||
DockerRootDir: daemon.config().Root,
|
DockerRootDir: daemon.config().Root,
|
||||||
Labels: daemon.config().Labels,
|
Labels: daemon.config().Labels,
|
||||||
ExperimentalBuild: utils.ExperimentalBuild(),
|
ExperimentalBuild: utils.ExperimentalBuild(),
|
||||||
ServerVersion: dockerversion.VERSION,
|
ServerVersion: dockerversion.Version,
|
||||||
ClusterStore: daemon.config().ClusterStore,
|
ClusterStore: daemon.config().ClusterStore,
|
||||||
ClusterAdvertise: daemon.config().ClusterAdvertise,
|
ClusterAdvertise: daemon.config().ClusterAdvertise,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
||||||
"github.com/aws/aws-sdk-go/aws/request"
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
|
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/daemon/logger"
|
"github.com/docker/docker/daemon/logger"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -150,7 +150,7 @@ func newAWSLogsClient(ctx logger.Context) (api, error) {
|
|||||||
currentAgent := r.HTTPRequest.Header.Get(userAgentHeader)
|
currentAgent := r.HTTPRequest.Header.Get(userAgentHeader)
|
||||||
r.HTTPRequest.Header.Set(userAgentHeader,
|
r.HTTPRequest.Header.Set(userAgentHeader,
|
||||||
fmt.Sprintf("Docker %s (%s) %s",
|
fmt.Sprintf("Docker %s (%s) %s",
|
||||||
dockerversion.VERSION, runtime.GOOS, currentAgent))
|
dockerversion.Version, runtime.GOOS, currentAgent))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return client, nil
|
return client, nil
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import (
|
|||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
"github.com/aws/aws-sdk-go/aws/request"
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
|
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/daemon/logger"
|
"github.com/docker/docker/daemon/logger"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -48,7 +48,7 @@ func TestNewAWSLogsClientUserAgentHandler(t *testing.T) {
|
|||||||
}
|
}
|
||||||
buildHandlerList.Run(request)
|
buildHandlerList.Run(request)
|
||||||
expectedUserAgentString := fmt.Sprintf("Docker %s (%s) %s/%s",
|
expectedUserAgentString := fmt.Sprintf("Docker %s (%s) %s/%s",
|
||||||
dockerversion.VERSION, runtime.GOOS, aws.SDKName, aws.SDKVersion)
|
dockerversion.Version, runtime.GOOS, aws.SDKName, aws.SDKVersion)
|
||||||
userAgent := request.HTTPRequest.Header.Get("User-Agent")
|
userAgent := request.HTTPRequest.Header.Get("User-Agent")
|
||||||
if userAgent != expectedUserAgentString {
|
if userAgent != expectedUserAgentString {
|
||||||
t.Errorf("Wrong User-Agent string, expected \"%s\" but was \"%s\"",
|
t.Errorf("Wrong User-Agent string, expected \"%s\" but was \"%s\"",
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import (
|
|||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/distribution/uuid"
|
"github.com/docker/distribution/uuid"
|
||||||
apiserver "github.com/docker/docker/api/server"
|
apiserver "github.com/docker/docker/api/server"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/cli"
|
"github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/cliconfig"
|
"github.com/docker/docker/cliconfig"
|
||||||
"github.com/docker/docker/daemon"
|
"github.com/docker/docker/daemon"
|
||||||
"github.com/docker/docker/daemon/logger"
|
"github.com/docker/docker/daemon/logger"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/docker/pkg/pidfile"
|
"github.com/docker/docker/pkg/pidfile"
|
||||||
@@ -206,7 +206,7 @@ func (cli *DaemonCli) CmdDaemon(args ...string) error {
|
|||||||
|
|
||||||
serverConfig := &apiserver.Config{
|
serverConfig := &apiserver.Config{
|
||||||
Logging: true,
|
Logging: true,
|
||||||
Version: dockerversion.VERSION,
|
Version: dockerversion.Version,
|
||||||
}
|
}
|
||||||
serverConfig = setPlatformServerConfig(serverConfig, cli.Config)
|
serverConfig = setPlatformServerConfig(serverConfig, cli.Config)
|
||||||
|
|
||||||
@@ -279,8 +279,8 @@ func (cli *DaemonCli) CmdDaemon(args ...string) error {
|
|||||||
logrus.Info("Daemon has completed initialization")
|
logrus.Info("Daemon has completed initialization")
|
||||||
|
|
||||||
logrus.WithFields(logrus.Fields{
|
logrus.WithFields(logrus.Fields{
|
||||||
"version": dockerversion.VERSION,
|
"version": dockerversion.Version,
|
||||||
"commit": dockerversion.GITCOMMIT,
|
"commit": dockerversion.GitCommit,
|
||||||
"execdriver": d.ExecutionDriver().Name(),
|
"execdriver": d.ExecutionDriver().Name(),
|
||||||
"graphdriver": d.GraphDriver().String(),
|
"graphdriver": d.GraphDriver().String(),
|
||||||
}).Info("Docker daemon")
|
}).Info("Docker daemon")
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/api/client"
|
"github.com/docker/docker/api/client"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/cli"
|
"github.com/docker/docker/cli"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/docker/pkg/reexec"
|
"github.com/docker/docker/pkg/reexec"
|
||||||
"github.com/docker/docker/pkg/term"
|
"github.com/docker/docker/pkg/term"
|
||||||
@@ -77,8 +77,8 @@ func main() {
|
|||||||
|
|
||||||
func showVersion() {
|
func showVersion() {
|
||||||
if utils.ExperimentalBuild() {
|
if utils.ExperimentalBuild() {
|
||||||
fmt.Printf("Docker version %s, build %s, experimental\n", dockerversion.VERSION, dockerversion.GITCOMMIT)
|
fmt.Printf("Docker version %s, build %s, experimental\n", dockerversion.Version, dockerversion.GitCommit)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Docker version %s, build %s\n", dockerversion.VERSION, dockerversion.GITCOMMIT)
|
fmt.Printf("Docker version %s, build %s\n", dockerversion.Version, dockerversion.GitCommit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
dockerversion/version_lib.go
Normal file
16
dockerversion/version_lib.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// +build !autogen
|
||||||
|
|
||||||
|
// Package dockerversion is auto-generated at build-time
|
||||||
|
package dockerversion
|
||||||
|
|
||||||
|
// Default build-time variable for library-import.
|
||||||
|
// This file is overridden on build with build-time informations.
|
||||||
|
const (
|
||||||
|
GitCommit string = "library-import"
|
||||||
|
Version string = "library-import"
|
||||||
|
BuildTime string = "library-import"
|
||||||
|
|
||||||
|
IAmStatic string = "library-import"
|
||||||
|
InitSHA1 string = "library-import"
|
||||||
|
InitPath string = "library-import"
|
||||||
|
)
|
||||||
@@ -17,8 +17,8 @@ import (
|
|||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/distribution/digest"
|
"github.com/docker/distribution/digest"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/idtools"
|
"github.com/docker/docker/pkg/idtools"
|
||||||
@@ -251,7 +251,7 @@ func (graph *Graph) Create(layerData io.Reader, containerID, containerImage, com
|
|||||||
ID: stringid.GenerateRandomID(),
|
ID: stringid.GenerateRandomID(),
|
||||||
Comment: comment,
|
Comment: comment,
|
||||||
Created: time.Now().UTC(),
|
Created: time.Now().UTC(),
|
||||||
DockerVersion: dockerversion.VERSION,
|
DockerVersion: dockerversion.Version,
|
||||||
Author: author,
|
Author: author,
|
||||||
Config: config,
|
Config: config,
|
||||||
Architecture: runtime.GOARCH,
|
Architecture: runtime.GOARCH,
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
|
||||||
"github.com/docker/docker/daemon/graphdriver"
|
"github.com/docker/docker/daemon/graphdriver"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
)
|
)
|
||||||
@@ -106,8 +106,8 @@ func TestGraphCreate(t *testing.T) {
|
|||||||
if img.Comment != "Testing" {
|
if img.Comment != "Testing" {
|
||||||
t.Fatalf("Wrong comment: should be '%s', not '%s'", "Testing", img.Comment)
|
t.Fatalf("Wrong comment: should be '%s', not '%s'", "Testing", img.Comment)
|
||||||
}
|
}
|
||||||
if img.DockerVersion != dockerversion.VERSION {
|
if img.DockerVersion != dockerversion.Version {
|
||||||
t.Fatalf("Wrong docker_version: should be '%s', not '%s'", dockerversion.VERSION, img.DockerVersion)
|
t.Fatalf("Wrong docker_version: should be '%s', not '%s'", dockerversion.Version, img.DockerVersion)
|
||||||
}
|
}
|
||||||
images := graph.Map()
|
images := graph.Map()
|
||||||
if l := len(images); l != 1 {
|
if l := len(images); l != 1 {
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ fi
|
|||||||
EXTLDFLAGS_STATIC='-static'
|
EXTLDFLAGS_STATIC='-static'
|
||||||
# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
|
# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
|
||||||
# with options like -race.
|
# with options like -race.
|
||||||
ORIG_BUILDFLAGS=( -a -tags "netgo static_build sqlite_omit_load_extension $DOCKER_BUILDTAGS" -installsuffix netgo )
|
ORIG_BUILDFLAGS=( -a -tags "autogen netgo static_build sqlite_omit_load_extension $DOCKER_BUILDTAGS" -installsuffix netgo )
|
||||||
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
|
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
|
||||||
BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
|
BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
|
||||||
# Test timeout.
|
# Test timeout.
|
||||||
|
|||||||
@@ -2,20 +2,23 @@
|
|||||||
|
|
||||||
rm -rf autogen
|
rm -rf autogen
|
||||||
|
|
||||||
mkdir -p autogen/dockerversion
|
cat > dockerversion/version_autogen.go <<DVEOF
|
||||||
cat > autogen/dockerversion/dockerversion.go <<DVEOF
|
// +build autogen
|
||||||
// AUTOGENERATED FILE; see $BASH_SOURCE
|
// Package version is auto-generated at build-time
|
||||||
package dockerversion
|
package dockerversion
|
||||||
|
|
||||||
var (
|
// Default build-time variable for library-import.
|
||||||
GITCOMMIT string = "$GITCOMMIT"
|
// This file is overridden on build with build-time informations.
|
||||||
VERSION string = "$VERSION"
|
const (
|
||||||
BUILDTIME string = "$BUILDTIME"
|
GitCommit string = "$GITCOMMIT"
|
||||||
|
Version string = "$VERSION"
|
||||||
|
BuildTime string = "$BUILDTIME"
|
||||||
|
|
||||||
IAMSTATIC string = "${IAMSTATIC:-true}"
|
IAmStatic string = "${IAMSTATIC:-true}"
|
||||||
INITSHA1 string = "$DOCKER_INITSHA1"
|
InitSHA1 string = "$DOCKER_INITSHA1"
|
||||||
INITPATH string = "$DOCKER_INITPATH"
|
InitPath string = "$DOCKER_INITPATH"
|
||||||
)
|
)
|
||||||
|
// AUTOGENERATED FILE; see $BASH_SOURCE
|
||||||
DVEOF
|
DVEOF
|
||||||
|
|
||||||
# Compile the Windows resources into the sources
|
# Compile the Windows resources into the sources
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/integration/checker"
|
"github.com/docker/docker/pkg/integration/checker"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
)
|
)
|
||||||
@@ -19,5 +19,5 @@ func (s *DockerSuite) TestGetVersion(c *check.C) {
|
|||||||
|
|
||||||
c.Assert(json.Unmarshal(body, &v), checker.IsNil)
|
c.Assert(json.Unmarshal(body, &v), checker.IsNil)
|
||||||
|
|
||||||
c.Assert(v.Version, checker.Equals, dockerversion.VERSION, check.Commentf("Version mismatch"))
|
c.Assert(v.Version, checker.Equals, dockerversion.Version, check.Commentf("Version mismatch"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/homedir"
|
"github.com/docker/docker/pkg/homedir"
|
||||||
"github.com/docker/docker/pkg/integration/checker"
|
"github.com/docker/docker/pkg/integration/checker"
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
@@ -54,7 +54,7 @@ func (s *DockerSuite) TestConfigHttpHeader(c *check.C) {
|
|||||||
|
|
||||||
c.Assert(headers["User-Agent"], checker.NotNil, check.Commentf("Missing User-Agent"))
|
c.Assert(headers["User-Agent"], checker.NotNil, check.Commentf("Missing User-Agent"))
|
||||||
|
|
||||||
c.Assert(headers["User-Agent"][0], checker.Equals, "Docker-Client/"+dockerversion.VERSION+" ("+runtime.GOOS+")", check.Commentf("Badly formatted User-Agent,out:%v", out))
|
c.Assert(headers["User-Agent"][0], checker.Equals, "Docker-Client/"+dockerversion.Version+" ("+runtime.GOOS+")", check.Commentf("Badly formatted User-Agent,out:%v", out))
|
||||||
|
|
||||||
c.Assert(headers["Myheader"], checker.NotNil)
|
c.Assert(headers["Myheader"], checker.NotNil)
|
||||||
c.Assert(headers["Myheader"][0], checker.Equals, "MyValue", check.Commentf("Missing/bad header,out:%v", out))
|
c.Assert(headers["Myheader"][0], checker.Equals, "MyValue", check.Commentf("Missing/bad header,out:%v", out))
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/docker/distribution/registry/api/v2"
|
"github.com/docker/distribution/registry/api/v2"
|
||||||
"github.com/docker/distribution/registry/client"
|
"github.com/docker/distribution/registry/client"
|
||||||
"github.com/docker/distribution/registry/client/transport"
|
"github.com/docker/distribution/registry/client/transport"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/parsers/kernel"
|
"github.com/docker/docker/pkg/parsers/kernel"
|
||||||
"github.com/docker/docker/pkg/tlsconfig"
|
"github.com/docker/docker/pkg/tlsconfig"
|
||||||
"github.com/docker/docker/pkg/useragent"
|
"github.com/docker/docker/pkg/useragent"
|
||||||
@@ -39,9 +39,9 @@ var dockerUserAgent string
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
httpVersion := make([]useragent.VersionInfo, 0, 6)
|
httpVersion := make([]useragent.VersionInfo, 0, 6)
|
||||||
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "docker", Version: dockerversion.VERSION})
|
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "docker", Version: dockerversion.Version})
|
||||||
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "go", Version: runtime.Version()})
|
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "go", Version: runtime.Version()})
|
||||||
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "git-commit", Version: dockerversion.GITCOMMIT})
|
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "git-commit", Version: dockerversion.GitCommit})
|
||||||
if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
|
if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
|
||||||
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "kernel", Version: kernelVersion.String()})
|
httpVersion = append(httpVersion, useragent.VersionInfo{Name: "kernel", Version: kernelVersion.String()})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/distribution/registry/api/errcode"
|
"github.com/docker/distribution/registry/api/errcode"
|
||||||
"github.com/docker/docker/autogen/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/fileutils"
|
"github.com/docker/docker/pkg/fileutils"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
@@ -60,7 +60,7 @@ func isValidDockerInitPath(target string, selfPath string) bool { // target and
|
|||||||
if target == "" {
|
if target == "" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if dockerversion.IAMSTATIC == "true" {
|
if dockerversion.IAmStatic == "true" {
|
||||||
if selfPath == "" {
|
if selfPath == "" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ func isValidDockerInitPath(target string, selfPath string) bool { // target and
|
|||||||
}
|
}
|
||||||
return os.SameFile(targetFileInfo, selfPathFileInfo)
|
return os.SameFile(targetFileInfo, selfPathFileInfo)
|
||||||
}
|
}
|
||||||
return dockerversion.INITSHA1 != "" && dockerInitSha1(target) == dockerversion.INITSHA1
|
return dockerversion.InitSHA1 != "" && dockerInitSha1(target) == dockerversion.InitSHA1
|
||||||
}
|
}
|
||||||
|
|
||||||
// DockerInitPath figures out the path of our dockerinit (which may be SelfPath())
|
// DockerInitPath figures out the path of our dockerinit (which may be SelfPath())
|
||||||
@@ -89,7 +89,7 @@ func DockerInitPath(localCopy string) string {
|
|||||||
}
|
}
|
||||||
var possibleInits = []string{
|
var possibleInits = []string{
|
||||||
localCopy,
|
localCopy,
|
||||||
dockerversion.INITPATH,
|
dockerversion.InitPath,
|
||||||
filepath.Join(filepath.Dir(selfPath), "dockerinit"),
|
filepath.Join(filepath.Dir(selfPath), "dockerinit"),
|
||||||
|
|
||||||
// FHS 3.0 Draft: "/usr/libexec includes internal binaries that are not intended to be executed directly by users or shell scripts. Applications may use a single subdirectory under /usr/libexec."
|
// FHS 3.0 Draft: "/usr/libexec includes internal binaries that are not intended to be executed directly by users or shell scripts. Applications may use a single subdirectory under /usr/libexec."
|
||||||
|
|||||||
Reference in New Issue
Block a user