diff --git a/api/server/router/local/image.go b/api/server/router/local/image.go index 0bf58f310e..0826ee1e2f 100644 --- a/api/server/router/local/image.go +++ b/api/server/router/local/image.go @@ -386,9 +386,14 @@ func (s *router) postBuild(ctx context.Context, w http.ResponseWriter, r *http.R UIDMaps: uidMaps, GIDMaps: gidMaps, } - docker := daemonbuilder.Docker{s.daemon, output, authConfigs, defaultArchiver} + docker := &daemonbuilder.Docker{ + Daemon: s.daemon, + OutOld: output, + AuthConfigs: authConfigs, + Archiver: defaultArchiver, + } - b, err := dockerfile.NewBuilder(buildConfig, docker, builder.DockerIgnoreContext{context}, nil) + b, err := dockerfile.NewBuilder(buildConfig, docker, builder.DockerIgnoreContext{ModifiableContext: context}, nil) if err != nil { return errf(err) } diff --git a/daemon/create.go b/daemon/create.go index 61c60cfc93..d9aa3b29a9 100644 --- a/daemon/create.go +++ b/daemon/create.go @@ -31,7 +31,7 @@ func (daemon *Daemon) ContainerCreate(params *ContainerCreateConfig) (types.Cont warnings, err := daemon.verifyContainerSettings(params.HostConfig, params.Config) if err != nil { - return types.ContainerCreateResponse{"", warnings}, err + return types.ContainerCreateResponse{ID: "", Warnings: warnings}, err } daemon.adaptContainerSettings(params.HostConfig, params.AdjustCPUShares) @@ -40,18 +40,18 @@ func (daemon *Daemon) ContainerCreate(params *ContainerCreateConfig) (types.Cont if err != nil { if daemon.Graph().IsNotExist(err, params.Config.Image) { if strings.Contains(params.Config.Image, "@") { - return types.ContainerCreateResponse{"", warnings}, derr.ErrorCodeNoSuchImageHash.WithArgs(params.Config.Image) + return types.ContainerCreateResponse{ID: "", Warnings: warnings}, derr.ErrorCodeNoSuchImageHash.WithArgs(params.Config.Image) } img, tag := parsers.ParseRepositoryTag(params.Config.Image) if tag == "" { tag = tags.DefaultTag } - return types.ContainerCreateResponse{"", warnings}, derr.ErrorCodeNoSuchImageTag.WithArgs(img, tag) + return types.ContainerCreateResponse{ID: "", Warnings: warnings}, derr.ErrorCodeNoSuchImageTag.WithArgs(img, tag) } - return types.ContainerCreateResponse{"", warnings}, err + return types.ContainerCreateResponse{ID: "", Warnings: warnings}, err } - return types.ContainerCreateResponse{container.ID, warnings}, nil + return types.ContainerCreateResponse{ID: container.ID, Warnings: warnings}, nil } // Create creates a new container from the given configuration with a given name. diff --git a/daemon/inspect.go b/daemon/inspect.go index 86eba4da7a..1268bc0168 100644 --- a/daemon/inspect.go +++ b/daemon/inspect.go @@ -43,7 +43,12 @@ func (daemon *Daemon) ContainerInspect(name string, size bool) (*types.Container Networks: container.NetworkSettings.Networks, } - return &types.ContainerJSON{base, mountPoints, container.Config, networkSettings}, nil + return &types.ContainerJSON{ + ContainerJSONBase: base, + Mounts: mountPoints, + Config: container.Config, + NetworkSettings: networkSettings, + }, nil } // ContainerInspect120 serializes the master version of a container into a json type. @@ -63,15 +68,20 @@ func (daemon *Daemon) ContainerInspect120(name string) (*v1p20.ContainerJSON, er mountPoints := addMountPoints(container) config := &v1p20.ContainerConfig{ - container.Config, - container.Config.MacAddress, - container.Config.NetworkDisabled, - container.Config.ExposedPorts, - container.hostConfig.VolumeDriver, + Config: container.Config, + MacAddress: container.Config.MacAddress, + NetworkDisabled: container.Config.NetworkDisabled, + ExposedPorts: container.Config.ExposedPorts, + VolumeDriver: container.hostConfig.VolumeDriver, } networkSettings := daemon.getBackwardsCompatibleNetworkSettings(container.NetworkSettings) - return &v1p20.ContainerJSON{base, mountPoints, config, networkSettings}, nil + return &v1p20.ContainerJSON{ + ContainerJSONBase: base, + Mounts: mountPoints, + Config: config, + NetworkSettings: networkSettings, + }, nil } func (daemon *Daemon) getInspectData(container *Container, size bool) (*types.ContainerJSONBase, error) { diff --git a/daemon/inspect_unix.go b/daemon/inspect_unix.go index 92c967a3af..d445660ff9 100644 --- a/daemon/inspect_unix.go +++ b/daemon/inspect_unix.go @@ -40,19 +40,25 @@ func (daemon *Daemon) ContainerInspectPre120(name string) (*v1p19.ContainerJSON, } config := &v1p19.ContainerConfig{ - container.Config, - container.Config.MacAddress, - container.Config.NetworkDisabled, - container.Config.ExposedPorts, - container.hostConfig.VolumeDriver, - container.hostConfig.Memory, - container.hostConfig.MemorySwap, - container.hostConfig.CPUShares, - container.hostConfig.CpusetCpus, + Config: container.Config, + MacAddress: container.Config.MacAddress, + NetworkDisabled: container.Config.NetworkDisabled, + ExposedPorts: container.Config.ExposedPorts, + VolumeDriver: container.hostConfig.VolumeDriver, + Memory: container.hostConfig.Memory, + MemorySwap: container.hostConfig.MemorySwap, + CPUShares: container.hostConfig.CPUShares, + CPUSet: container.hostConfig.CpusetCpus, } networkSettings := daemon.getBackwardsCompatibleNetworkSettings(container.NetworkSettings) - return &v1p19.ContainerJSON{base, volumes, volumesRW, config, networkSettings}, nil + return &v1p19.ContainerJSON{ + ContainerJSONBase: base, + Volumes: volumes, + VolumesRW: volumesRW, + Config: config, + NetworkSettings: networkSettings, + }, nil } func addMountPoints(container *Container) []types.MountPoint { diff --git a/graph/pull_v1.go b/graph/pull_v1.go index 754b041db1..51150dbee9 100644 --- a/graph/pull_v1.go +++ b/graph/pull_v1.go @@ -31,7 +31,7 @@ type v1Puller struct { func (p *v1Puller) Pull(tag string) (fallback bool, err error) { if utils.DigestReference(tag) { // Allowing fallback, because HTTPS v1 is before HTTP v2 - return true, registry.ErrNoSupport{errors.New("Cannot pull by digest with v1 registry")} + return true, registry.ErrNoSupport{Err: errors.New("Cannot pull by digest with v1 registry")} } tlsConfig, err := p.registryService.TLSConfig(p.repoInfo.Index.Name) diff --git a/pkg/archive/changes.go b/pkg/archive/changes.go index 49593eff45..e0bd4c461e 100644 --- a/pkg/archive/changes.go +++ b/pkg/archive/changes.go @@ -31,6 +31,18 @@ const ( ChangeDelete ) +func (c ChangeType) String() string { + switch c { + case ChangeModify: + return "C" + case ChangeAdd: + return "A" + case ChangeDelete: + return "D" + } + return "" +} + // Change represents a change, it wraps the change type and path. // It describes changes of the files in the path respect to the // parent layers. The change could be modify, add, delete. @@ -41,16 +53,7 @@ type Change struct { } func (change *Change) String() string { - var kind string - switch change.Kind { - case ChangeModify: - kind = "C" - case ChangeAdd: - kind = "A" - case ChangeDelete: - kind = "D" - } - return fmt.Sprintf("%s %s", kind, change.Path) + return fmt.Sprintf("%s %s", change.Kind, change.Path) } // for sort.Sort diff --git a/registry/registry.go b/registry/registry.go index 389bd959df..bd5251e1a3 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -39,14 +39,14 @@ var dockerUserAgent string func init() { httpVersion := make([]useragent.VersionInfo, 0, 6) - httpVersion = append(httpVersion, useragent.VersionInfo{"docker", dockerversion.VERSION}) - httpVersion = append(httpVersion, useragent.VersionInfo{"go", runtime.Version()}) - httpVersion = append(httpVersion, useragent.VersionInfo{"git-commit", dockerversion.GITCOMMIT}) + 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: "git-commit", Version: dockerversion.GITCOMMIT}) if kernelVersion, err := kernel.GetKernelVersion(); err == nil { - httpVersion = append(httpVersion, useragent.VersionInfo{"kernel", kernelVersion.String()}) + httpVersion = append(httpVersion, useragent.VersionInfo{Name: "kernel", Version: kernelVersion.String()}) } - httpVersion = append(httpVersion, useragent.VersionInfo{"os", runtime.GOOS}) - httpVersion = append(httpVersion, useragent.VersionInfo{"arch", runtime.GOARCH}) + httpVersion = append(httpVersion, useragent.VersionInfo{Name: "os", Version: runtime.GOOS}) + httpVersion = append(httpVersion, useragent.VersionInfo{Name: "arch", Version: runtime.GOARCH}) dockerUserAgent = useragent.AppendVersions("", httpVersion...)