Merge branch 'master' into runtime-version
Signed-off-by: Carlos de Paula <me@carlosedp.com>
This commit is contained in:
commit
400af1717c
243 changed files with 661 additions and 722 deletions
|
@ -176,8 +176,8 @@ COPY hack/dockerfile/install/install.sh ./install.sh
|
|||
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
|
||||
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
|
||||
|
||||
FROM base AS gometalinter
|
||||
ENV INSTALL_BINARY_NAME=gometalinter
|
||||
FROM base AS golangci_lint
|
||||
ENV INSTALL_BINARY_NAME=golangci_lint
|
||||
COPY hack/dockerfile/install/install.sh ./install.sh
|
||||
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
|
||||
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
|
||||
|
@ -265,7 +265,7 @@ RUN pip3 install yamllint==1.16.0
|
|||
|
||||
COPY --from=swagger /build/swagger* /usr/local/bin/
|
||||
COPY --from=frozen-images /build/ /docker-frozen-images
|
||||
COPY --from=gometalinter /build/ /usr/local/bin/
|
||||
COPY --from=golangci_lint /build/ /usr/local/bin/
|
||||
COPY --from=gotestsum /build/ /usr/local/bin/
|
||||
COPY --from=tomlv /build/ /usr/local/bin/
|
||||
COPY --from=vndr /build/ /usr/local/bin/
|
||||
|
|
|
@ -31,7 +31,7 @@ func HijackConnection(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) {
|
|||
return nil, nil, err
|
||||
}
|
||||
// Flush the options to make sure the client sets the raw mode
|
||||
conn.Write([]byte{})
|
||||
_, _ = conn.Write([]byte{})
|
||||
return conn, conn, nil
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,9 @@ func CloseStreams(streams ...interface{}) {
|
|||
if tcpc, ok := stream.(interface {
|
||||
CloseWrite() error
|
||||
}); ok {
|
||||
tcpc.CloseWrite()
|
||||
_ = tcpc.CloseWrite()
|
||||
} else if closer, ok := stream.(io.Closer); ok {
|
||||
closer.Close()
|
||||
_ = closer.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ func MakeErrorHandler(err error) http.HandlerFunc {
|
|||
response := &types.ErrorResponse{
|
||||
Message: err.Error(),
|
||||
}
|
||||
WriteJSON(w, statusCode, response)
|
||||
_ = WriteJSON(w, statusCode, response)
|
||||
} else {
|
||||
http.Error(w, status.Convert(err).Message(), statusCode)
|
||||
}
|
||||
|
|
|
@ -51,10 +51,10 @@ func WriteLogStream(_ context.Context, w io.Writer, msgs <-chan *backend.LogMess
|
|||
logLine = append([]byte(msg.Timestamp.Format(jsonmessage.RFC3339NanoFixed)+" "), logLine...)
|
||||
}
|
||||
if msg.Source == "stdout" && config.ShowStdout {
|
||||
outStream.Write(logLine)
|
||||
_, _ = outStream.Write(logLine)
|
||||
}
|
||||
if msg.Source == "stderr" && config.ShowStderr {
|
||||
errStream.Write(logLine)
|
||||
_, _ = errStream.Write(logLine)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ func (br *buildRouter) postPrune(ctx context.Context, w http.ResponseWriter, r *
|
|||
if err := httputils.ParseForm(r); err != nil {
|
||||
return err
|
||||
}
|
||||
filters, err := filters.FromJSON(r.Form.Get("filters"))
|
||||
fltrs, err := filters.FromJSON(r.Form.Get("filters"))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not parse filters")
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ func (br *buildRouter) postPrune(ctx context.Context, w http.ResponseWriter, r *
|
|||
|
||||
opts := types.BuildCachePruneOptions{
|
||||
All: httputils.BoolValue(r, "all"),
|
||||
Filters: filters,
|
||||
Filters: fltrs,
|
||||
KeepStorage: int64(ks),
|
||||
}
|
||||
|
||||
|
@ -234,12 +234,12 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
|
|||
}
|
||||
|
||||
output := ioutils.NewWriteFlusher(ww)
|
||||
defer output.Close()
|
||||
defer func() { _ = output.Close() }()
|
||||
|
||||
errf := func(err error) error {
|
||||
|
||||
if httputils.BoolValue(r, "q") && notVerboseBuffer.Len() > 0 {
|
||||
output.Write(notVerboseBuffer.Bytes())
|
||||
_, _ = output.Write(notVerboseBuffer.Bytes())
|
||||
}
|
||||
|
||||
// Do not write the error in the http output if it's still empty.
|
||||
|
@ -290,7 +290,7 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
|
|||
// Everything worked so if -q was provided the output from the daemon
|
||||
// should be just the image ID and we'll print that to stdout.
|
||||
if buildOptions.SuppressOutput {
|
||||
fmt.Fprintln(streamformatter.NewStdoutWriter(output), imgID)
|
||||
_, _ = fmt.Fprintln(streamformatter.NewStdoutWriter(output), imgID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ func getAuthConfigs(header http.Header) map[string]types.AuthConfig {
|
|||
authConfigsJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authConfigsEncoded))
|
||||
// Pulling an image does not error when no auth is provided so to remain
|
||||
// consistent with the existing api decode errors are ignored
|
||||
json.NewDecoder(authConfigsJSON).Decode(&authConfigs)
|
||||
_ = json.NewDecoder(authConfigsJSON).Decode(&authConfigs)
|
||||
return authConfigs
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ func (w *wcf) notify() {
|
|||
w.mu.Lock()
|
||||
if !w.ready {
|
||||
if w.buf.Len() > 0 {
|
||||
io.Copy(w.Writer, w.buf)
|
||||
_, _ = io.Copy(w.Writer, w.buf)
|
||||
}
|
||||
if w.flushed {
|
||||
w.flusher.Flush()
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ func (s *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrite
|
|||
if !output.Flushed() {
|
||||
return err
|
||||
}
|
||||
output.Write(streamformatter.FormatError(err))
|
||||
_, _ = output.Write(streamformatter.FormatError(err))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -136,7 +136,7 @@ func (s *imageRouter) postImagesPush(ctx context.Context, w http.ResponseWriter,
|
|||
if !output.Flushed() {
|
||||
return err
|
||||
}
|
||||
output.Write(streamformatter.FormatError(err))
|
||||
_, _ = output.Write(streamformatter.FormatError(err))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ func (s *imageRouter) getImagesGet(ctx context.Context, w http.ResponseWriter, r
|
|||
if !output.Flushed() {
|
||||
return err
|
||||
}
|
||||
output.Write(streamformatter.FormatError(err))
|
||||
_, _ = output.Write(streamformatter.FormatError(err))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ func (s *imageRouter) postImagesLoad(ctx context.Context, w http.ResponseWriter,
|
|||
output := ioutils.NewWriteFlusher(w)
|
||||
defer output.Close()
|
||||
if err := s.backend.LoadImage(r.Body, output, quiet); err != nil {
|
||||
output.Write(streamformatter.FormatError(err))
|
||||
_, _ = output.Write(streamformatter.FormatError(err))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ func (pr *pluginRouter) upgradePlugin(ctx context.Context, w http.ResponseWriter
|
|||
if !output.Flushed() {
|
||||
return err
|
||||
}
|
||||
output.Write(streamformatter.FormatError(err))
|
||||
_, _ = output.Write(streamformatter.FormatError(err))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -162,7 +162,7 @@ func (pr *pluginRouter) pullPlugin(ctx context.Context, w http.ResponseWriter, r
|
|||
if !output.Flushed() {
|
||||
return err
|
||||
}
|
||||
output.Write(streamformatter.FormatError(err))
|
||||
_, _ = output.Write(streamformatter.FormatError(err))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -270,7 +270,7 @@ func (pr *pluginRouter) pushPlugin(ctx context.Context, w http.ResponseWriter, r
|
|||
if !output.Flushed() {
|
||||
return err
|
||||
}
|
||||
output.Write(streamformatter.FormatError(err))
|
||||
_, _ = output.Write(streamformatter.FormatError(err))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package system // import "github.com/docker/docker/api/server/router/system"
|
|||
|
||||
import (
|
||||
"github.com/docker/docker/api/server/router"
|
||||
"github.com/docker/docker/builder/builder-next"
|
||||
buildkit "github.com/docker/docker/builder/builder-next"
|
||||
"github.com/docker/docker/builder/fscache"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
)
|
||||
|
||||
// CgroupnsMode represents the cgroup namespace mode of the container
|
||||
|
|
|
@ -57,7 +57,7 @@ func ToJSON(a Args) (string, error) {
|
|||
// then the encoded format will use an older legacy format where the values are a
|
||||
// list of strings, instead of a set.
|
||||
//
|
||||
// Deprecated: Use ToJSON
|
||||
// Deprecated: do not use in any new code; use ToJSON instead
|
||||
func ToParamWithVersion(version string, a Args) (string, error) {
|
||||
if a.Len() == 0 {
|
||||
return "", nil
|
||||
|
|
|
@ -337,14 +337,17 @@ func TestWalkValues(t *testing.T) {
|
|||
f.Add("status", "running")
|
||||
f.Add("status", "paused")
|
||||
|
||||
f.WalkValues("status", func(value string) error {
|
||||
err := f.WalkValues("status", func(value string) error {
|
||||
if value != "running" && value != "paused" {
|
||||
t.Fatalf("Unexpected value %s", value)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error, got %v", err)
|
||||
}
|
||||
|
||||
err := f.WalkValues("status", func(value string) error {
|
||||
err = f.WalkValues("status", func(value string) error {
|
||||
return errors.New("return")
|
||||
})
|
||||
if err == nil {
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"net"
|
||||
|
||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
// ServiceConfig stores daemon registry services configuration.
|
||||
|
|
|
@ -37,7 +37,7 @@ import (
|
|||
"github.com/moby/buildkit/util/progress"
|
||||
"github.com/moby/buildkit/util/resolver"
|
||||
"github.com/moby/buildkit/util/tracing"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/image-spec/identity"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -275,7 +275,7 @@ func (p *puller) resolve(ctx context.Context) error {
|
|||
ref, err := distreference.ParseNormalizedNamed(p.src.Reference.String())
|
||||
if err != nil {
|
||||
p.resolveErr = err
|
||||
resolveProgressDone(err)
|
||||
_ = resolveProgressDone(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ func (p *puller) resolve(ctx context.Context) error {
|
|||
origRef, desc, err := p.resolver.Resolve(ctx, ref.String())
|
||||
if err != nil {
|
||||
p.resolveErr = err
|
||||
resolveProgressDone(err)
|
||||
_ = resolveProgressDone(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -300,19 +300,19 @@ func (p *puller) resolve(ctx context.Context) error {
|
|||
ref, err := distreference.WithDigest(ref, p.desc.Digest)
|
||||
if err != nil {
|
||||
p.resolveErr = err
|
||||
resolveProgressDone(err)
|
||||
_ = resolveProgressDone(err)
|
||||
return
|
||||
}
|
||||
_, dt, err := p.is.ResolveImageConfig(ctx, ref.String(), gw.ResolveImageConfigOpt{Platform: &p.platform, ResolveMode: resolveModeToString(p.src.ResolveMode)}, p.sm)
|
||||
if err != nil {
|
||||
p.resolveErr = err
|
||||
resolveProgressDone(err)
|
||||
_ = resolveProgressDone(err)
|
||||
return
|
||||
}
|
||||
|
||||
p.config = dt
|
||||
}
|
||||
resolveProgressDone(nil)
|
||||
_ = resolveProgressDone(nil)
|
||||
})
|
||||
return p.resolveErr
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
|
|||
tm := time.Now()
|
||||
end = &tm
|
||||
}
|
||||
pw.Write("extracting "+p.ID, progress.Status{
|
||||
_ = pw.Write("extracting "+p.ID, progress.Status{
|
||||
Action: "extract",
|
||||
Started: &st.st,
|
||||
Completed: end,
|
||||
|
@ -672,7 +672,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store, pw progr
|
|||
refKey := remotes.MakeRefKey(ctx, j.Descriptor)
|
||||
if a, ok := actives[refKey]; ok {
|
||||
started := j.started
|
||||
pw.Write(j.Digest.String(), progress.Status{
|
||||
_ = pw.Write(j.Digest.String(), progress.Status{
|
||||
Action: a.Status,
|
||||
Total: int(a.Total),
|
||||
Current: int(a.Offset),
|
||||
|
@ -685,7 +685,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store, pw progr
|
|||
info, err := cs.Info(context.TODO(), j.Digest)
|
||||
if err != nil {
|
||||
if containerderrors.IsNotFound(err) {
|
||||
// pw.Write(j.Digest.String(), progress.Status{
|
||||
// _ = pw.Write(j.Digest.String(), progress.Status{
|
||||
// Action: "waiting",
|
||||
// })
|
||||
continue
|
||||
|
@ -697,7 +697,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store, pw progr
|
|||
if done || j.done {
|
||||
started := j.started
|
||||
createdAt := info.CreatedAt
|
||||
pw.Write(j.Digest.String(), progress.Status{
|
||||
_ = pw.Write(j.Digest.String(), progress.Status{
|
||||
Action: "done",
|
||||
Current: int(info.Size),
|
||||
Total: int(info.Size),
|
||||
|
@ -783,13 +783,13 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
|
|||
st := progress.Status{
|
||||
Started: &now,
|
||||
}
|
||||
pw.Write(id, st)
|
||||
_ = pw.Write(id, st)
|
||||
return func(err error) error {
|
||||
// TODO: set error on status
|
||||
now := time.Now()
|
||||
st.Completed = &now
|
||||
pw.Write(id, st)
|
||||
pw.Close()
|
||||
_ = pw.Write(id, st)
|
||||
_ = pw.Close()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, inp exporter.Source)
|
|||
diffs[i] = digest.Digest(diffIDs[i])
|
||||
}
|
||||
|
||||
layersDone(nil)
|
||||
_ = layersDone(nil)
|
||||
}
|
||||
|
||||
if len(config) == 0 {
|
||||
|
@ -160,7 +160,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, inp exporter.Source)
|
|||
if err != nil {
|
||||
return nil, configDone(err)
|
||||
}
|
||||
configDone(nil)
|
||||
_ = configDone(nil)
|
||||
|
||||
if e.opt.ReferenceStore != nil {
|
||||
for _, targetName := range e.targetNames {
|
||||
|
@ -169,7 +169,7 @@ func (e *imageExporterInstance) Export(ctx context.Context, inp exporter.Source)
|
|||
if err := e.opt.ReferenceStore.AddTag(targetName, digest.Digest(id), true); err != nil {
|
||||
return nil, tagDone(err)
|
||||
}
|
||||
tagDone(nil)
|
||||
_ = tagDone(nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,9 +78,9 @@ func patchImageConfig(dt []byte, dps []digest.Digest, history []ocispec.History,
|
|||
}
|
||||
|
||||
if cache != nil {
|
||||
dt, err := json.Marshal(cache)
|
||||
dt, err = json.Marshal(cache)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "failed to marshal cache")
|
||||
}
|
||||
m["moby.buildkit.cache.v0"] = dt
|
||||
}
|
||||
|
@ -204,13 +204,13 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
|
|||
st := progress.Status{
|
||||
Started: &now,
|
||||
}
|
||||
pw.Write(id, st)
|
||||
_ = pw.Write(id, st)
|
||||
return func(err error) error {
|
||||
// TODO: set error on status
|
||||
now := time.Now()
|
||||
st.Completed = &now
|
||||
pw.Write(id, st)
|
||||
pw.Close()
|
||||
_ = pw.Write(id, st)
|
||||
_ = pw.Close()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -394,7 +394,7 @@ func (ld *layerDescriptor) Download(ctx context.Context, progressOutput pkgprogr
|
|||
if err := contentutil.Copy(ctx, ld.w.ContentStore, ld.provider, ld.desc); err != nil {
|
||||
return nil, 0, done(err)
|
||||
}
|
||||
done(nil)
|
||||
_ = done(nil)
|
||||
|
||||
ra, err := ld.w.ContentStore.ReaderAt(ctx, ld.desc)
|
||||
if err != nil {
|
||||
|
@ -443,13 +443,13 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
|
|||
st := progress.Status{
|
||||
Started: &now,
|
||||
}
|
||||
pw.Write(id, st)
|
||||
_ = pw.Write(id, st)
|
||||
return func(err error) error {
|
||||
// TODO: set error on status
|
||||
now := time.Now()
|
||||
st.Completed = &now
|
||||
pw.Write(id, st)
|
||||
pw.Close()
|
||||
_ = pw.Write(id, st)
|
||||
_ = pw.Close()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ func fixPermissions(source, destination string, identity idtools.Identity, overr
|
|||
|
||||
// We Walk on the source rather than on the destination because we don't
|
||||
// want to change permissions on things we haven't created or modified.
|
||||
return filepath.Walk(source, func(fullpath string, info os.FileInfo, err error) error {
|
||||
return filepath.Walk(source, func(fullpath string, _ os.FileInfo, _ error) error {
|
||||
// Do not alter the walk root iff. it existed before, as it doesn't fall under
|
||||
// the domain of "things we should chown".
|
||||
if skipChownRoot && source == fullpath {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
winio "github.com/Microsoft/go-winio"
|
||||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/pkg/reexec"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
|
|
|
@ -88,9 +88,8 @@ func (m *imageSources) Add(im *imageMount) {
|
|||
|
||||
// imageMount is a reference to an image that can be used as a builder.Source
|
||||
type imageMount struct {
|
||||
image builder.Image
|
||||
source builder.Source
|
||||
layer builder.ROLayer
|
||||
image builder.Image
|
||||
layer builder.ROLayer
|
||||
}
|
||||
|
||||
func newImageMount(image builder.Image, layer builder.ROLayer) *imageMount {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package dockerfile // import "github.com/docker/docker/builder/dockerfile"
|
||||
|
||||
import (
|
||||
"github.com/docker/go-metrics"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -497,6 +497,7 @@ type sourceMeta struct {
|
|||
Size int64
|
||||
}
|
||||
|
||||
//nolint:structcheck
|
||||
type cachedSource struct {
|
||||
sourceMeta
|
||||
refs map[*cachedSourceRef]struct{}
|
||||
|
|
|
@ -142,9 +142,9 @@ func supportsShallowClone(remoteURL string) bool {
|
|||
serviceURL := remoteURL + "/info/refs?service=git-upload-pack"
|
||||
|
||||
// Try a HEAD request and fallback to a Get request on error
|
||||
res, err := http.Head(serviceURL)
|
||||
res, err := http.Head(serviceURL) // #nosec G107
|
||||
if err != nil || res.StatusCode != http.StatusOK {
|
||||
res, err = http.Get(serviceURL)
|
||||
res, err = http.Get(serviceURL) // #nosec G107
|
||||
if err == nil {
|
||||
res.Body.Close()
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ func downloadRemote(remoteURL string) (string, io.ReadCloser, error) {
|
|||
// GetWithStatusError does an http.Get() and returns an error if the
|
||||
// status code is 4xx or 5xx.
|
||||
func GetWithStatusError(address string) (resp *http.Response, err error) {
|
||||
// #nosec G107
|
||||
if resp, err = http.Get(address); err != nil {
|
||||
if uerr, ok := err.(*url.Error); ok {
|
||||
if derr, ok := uerr.Err.(*net.DNSError); ok && !derr.IsTimeout {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/pkg/containerfs"
|
||||
iradix "github.com/hashicorp/go-immutable-radix"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tonistiigi/fsutil"
|
||||
)
|
||||
|
|
|
@ -35,6 +35,7 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis
|
|||
}
|
||||
|
||||
if options.Filters.Len() > 0 {
|
||||
//lint:ignore SA1019 for old code
|
||||
filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -90,6 +90,7 @@ func buildEventsQueryParams(cliVersion string, options types.EventsOptions) (url
|
|||
}
|
||||
|
||||
if options.Filters.Len() > 0 {
|
||||
//lint:ignore SA1019 for old code
|
||||
filterJSON, err := filters.ToParamWithVersion(cliVersion, options.Filters)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -87,6 +87,8 @@ func (cli *Client) setupHijackConn(ctx context.Context, req *http.Request, proto
|
|||
|
||||
// Server hijacks the connection, error 'connection closed' expected
|
||||
resp, err := clientconn.Do(req)
|
||||
|
||||
//lint:ignore SA1019 for connecting to old (pre go1.8) daemons
|
||||
if err != httputil.ErrPersistEOF {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
)
|
||||
|
||||
func TestImageBuildError(t *testing.T) {
|
||||
|
|
|
@ -24,6 +24,7 @@ func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions
|
|||
}
|
||||
}
|
||||
if optionFilters.Len() > 0 {
|
||||
//lint:ignore SA1019 for old code
|
||||
filterJSON, err := filters.ToParamWithVersion(cli.version, optionFilters)
|
||||
if err != nil {
|
||||
return images, err
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
func (cli *Client) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) {
|
||||
query := url.Values{}
|
||||
if options.Filters.Len() > 0 {
|
||||
//lint:ignore SA1019 for old code
|
||||
filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -15,6 +15,7 @@ func (cli *Client) PluginList(ctx context.Context, filter filters.Args) (types.P
|
|||
query := url.Values{}
|
||||
|
||||
if filter.Len() > 0 {
|
||||
//lint:ignore SA1019 for old code
|
||||
filterJSON, err := filters.ToParamWithVersion(cli.version, filter)
|
||||
if err != nil {
|
||||
return plugins, err
|
||||
|
|
|
@ -50,15 +50,6 @@ func (cli *Client) postRaw(ctx context.Context, path string, query url.Values, b
|
|||
return cli.sendRequest(ctx, "POST", path, query, body, headers)
|
||||
}
|
||||
|
||||
// put sends an http request to the docker API using the method PUT.
|
||||
func (cli *Client) put(ctx context.Context, path string, query url.Values, obj interface{}, headers map[string][]string) (serverResponse, error) {
|
||||
body, headers, err := encodeBody(obj, headers)
|
||||
if err != nil {
|
||||
return serverResponse{}, err
|
||||
}
|
||||
return cli.sendRequest(ctx, "PUT", path, query, body, headers)
|
||||
}
|
||||
|
||||
// putRaw sends an http request to the docker API using the method PUT.
|
||||
func (cli *Client) putRaw(ctx context.Context, path string, query url.Values, body io.Reader, headers map[string][]string) (serverResponse, error) {
|
||||
return cli.sendRequest(ctx, "PUT", path, query, body, headers)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ import (
|
|||
registrytypes "github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
)
|
||||
|
|
|
@ -15,6 +15,7 @@ func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (volumet
|
|||
query := url.Values{}
|
||||
|
||||
if filter.Len() > 0 {
|
||||
//lint:ignore SA1019 for old code
|
||||
filterJSON, err := filters.ToParamWithVersion(cli.version, filter)
|
||||
if err != nil {
|
||||
return volumes, err
|
||||
|
|
|
@ -47,12 +47,12 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
|||
|
||||
// "--graph" is "soft-deprecated" in favor of "data-root". This flag was added
|
||||
// before Docker 1.0, so won't be removed, only hidden, to discourage its usage.
|
||||
flags.MarkHidden("graph")
|
||||
_ = flags.MarkHidden("graph")
|
||||
|
||||
flags.StringVar(&conf.Root, "data-root", defaultDataRoot, "Root directory of persistent Docker state")
|
||||
|
||||
flags.BoolVarP(&conf.AutoRestart, "restart", "r", true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
|
||||
flags.MarkDeprecated("restart", "Please use a restart policy on docker run")
|
||||
_ = flags.MarkDeprecated("restart", "Please use a restart policy on docker run")
|
||||
|
||||
// Windows doesn't support setting the storage driver - there is no choice as to which ones to use.
|
||||
if runtime.GOOS != "windows" {
|
||||
|
@ -75,7 +75,7 @@ func installCommonConfigFlags(conf *config.Config, flags *pflag.FlagSet) error {
|
|||
flags.IntVar(&maxConcurrentUploads, "max-concurrent-uploads", config.DefaultMaxConcurrentUploads, "Set the max concurrent uploads for each push")
|
||||
flags.IntVar(&conf.ShutdownTimeout, "shutdown-timeout", defaultShutdownTimeout, "Set the default shutdown timeout")
|
||||
flags.IntVar(&conf.NetworkDiagnosticPort, "network-diagnostic-port", 0, "TCP port number of the network diagnostic server")
|
||||
flags.MarkHidden("network-diagnostic-port")
|
||||
_ = flags.MarkHidden("network-diagnostic-port")
|
||||
|
||||
flags.StringVar(&conf.SwarmDefaultAdvertiseAddr, "swarm-default-advertise-addr", "", "Set default address or interface for swarm advertised address")
|
||||
flags.BoolVar(&conf.Experimental, "experimental", false, "Enable experimental features")
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/rootless"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/docker/go-metrics"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
|
@ -52,7 +52,7 @@ func installServiceFlags(flags *pflag.FlagSet) {
|
|||
flRegisterService = flags.Bool("register-service", false, "Register the service and exit")
|
||||
flUnregisterService = flags.Bool("unregister-service", false, "Unregister the service and exit")
|
||||
flRunService = flags.Bool("run-service", false, "")
|
||||
flags.MarkHidden("run-service")
|
||||
_ = flags.MarkHidden("run-service")
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
|
|
|
@ -36,7 +36,7 @@ import (
|
|||
"github.com/docker/docker/restartmanager"
|
||||
"github.com/docker/docker/volume"
|
||||
volumemounts "github.com/docker/docker/volume/mounts"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
agentexec "github.com/docker/swarmkit/agent/exec"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
)
|
||||
|
||||
// State holds the current container state, and has methods to get and
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/hashicorp/go-memdb"
|
||||
memdb "github.com/hashicorp/go-memdb"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ func byteSizeFromString(arg string) (int64, error) {
|
|||
|
||||
rest = strings.ToLower(strings.TrimSpace(rest))
|
||||
|
||||
var multiplier int64 = 1
|
||||
var multiplier int64
|
||||
switch rest {
|
||||
case "":
|
||||
multiplier = 1
|
||||
|
|
|
@ -35,16 +35,16 @@ func getCheckpointDir(checkDir, checkpointID, ctrName, ctrID, ctrCheckpointDir s
|
|||
err2 = os.MkdirAll(checkpointAbsDir, 0700)
|
||||
case err != nil:
|
||||
err2 = err
|
||||
case err == nil:
|
||||
default:
|
||||
err2 = fmt.Errorf("%s exists and is not a directory", checkpointAbsDir)
|
||||
}
|
||||
} else {
|
||||
switch {
|
||||
case err != nil:
|
||||
err2 = fmt.Errorf("checkpoint %s does not exist for container %s", checkpointID, ctrName)
|
||||
case err == nil && stat.IsDir():
|
||||
case stat.IsDir():
|
||||
err2 = nil
|
||||
case err == nil:
|
||||
default:
|
||||
err2 = fmt.Errorf("%s exists and is not a directory", checkpointAbsDir)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/docker/docker/api/types/swarm/runtime"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/plugin"
|
||||
"github.com/docker/docker/plugin/v2"
|
||||
v2 "github.com/docker/docker/plugin/v2"
|
||||
"github.com/docker/swarmkit/api"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -34,7 +34,6 @@ type Controller struct {
|
|||
|
||||
pluginID string
|
||||
serviceID string
|
||||
taskID string
|
||||
|
||||
// hook used to signal tests that `Wait()` is actually ready and waiting
|
||||
signalWaitReady func()
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/docker/docker/api/types/swarm/runtime"
|
||||
"github.com/docker/docker/pkg/pubsub"
|
||||
"github.com/docker/docker/plugin"
|
||||
"github.com/docker/docker/plugin/v2"
|
||||
v2 "github.com/docker/docker/plugin/v2"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
"github.com/docker/swarmkit/api"
|
||||
"github.com/docker/swarmkit/log"
|
||||
gogotypes "github.com/gogo/protobuf/types"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/time/rate"
|
||||
|
|
|
@ -98,10 +98,6 @@ func (c *containerConfig) taskID() string {
|
|||
return c.task.ID
|
||||
}
|
||||
|
||||
func (c *containerConfig) endpoint() *api.Endpoint {
|
||||
return c.task.Endpoint
|
||||
}
|
||||
|
||||
func (c *containerConfig) spec() *api.ContainerSpec {
|
||||
return c.task.Spec.GetContainer()
|
||||
}
|
||||
|
|
|
@ -637,7 +637,7 @@ func parsePortMap(portMap nat.PortMap) ([]*api.PortConfig, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
protocol := api.ProtocolTCP
|
||||
var protocol api.PortConfig_Protocol
|
||||
switch strings.ToLower(parts[1]) {
|
||||
case "tcp":
|
||||
protocol = api.ProtocolTCP
|
||||
|
|
|
@ -66,7 +66,7 @@ func (c *Cluster) GetNode(input string) (types.Node, error) {
|
|||
|
||||
// UpdateNode updates existing nodes properties.
|
||||
func (c *Cluster) UpdateNode(input string, version uint64, spec types.NodeSpec) error {
|
||||
return c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
|
||||
return c.lockedManagerAction(func(_ context.Context, state nodeState) error {
|
||||
nodeSpec, err := convert.NodeSpecToGRPC(spec)
|
||||
if err != nil {
|
||||
return errdefs.InvalidParameter(err)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/spf13/pflag"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package events // import "github.com/docker/docker/daemon/events"
|
||||
|
||||
import "github.com/docker/go-metrics"
|
||||
import metrics "github.com/docker/go-metrics"
|
||||
|
||||
var (
|
||||
eventsCounter metrics.Counter
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/docker/docker/pkg/pools"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/docker/docker/daemon/exec"
|
||||
"github.com/docker/docker/oci/caps"
|
||||
"github.com/opencontainers/runc/libcontainer/apparmor"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
func (daemon *Daemon) execSetPlatformOpt(c *container.Container, ec *exec.Config, p *specs.Process) error {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/daemon/exec"
|
||||
"github.com/opencontainers/runc/libcontainer/apparmor"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"gotest.tools/assert"
|
||||
)
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
@ -133,9 +133,6 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
|
|||
}
|
||||
|
||||
dstPath := filepath.Join(dstDir, relPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
stat, ok := f.Sys().(*syscall.Stat_t)
|
||||
if !ok {
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
@ -40,7 +40,7 @@ func initLoopbacks() error {
|
|||
// only create new loopback files if they don't exist
|
||||
if _, err := os.Stat(loopPath); err != nil {
|
||||
if mkerr := syscall.Mknod(loopPath,
|
||||
uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil {
|
||||
uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil { // nolint: unconvert
|
||||
return mkerr
|
||||
}
|
||||
os.Chown(loopPath, int(statT.Uid), int(statT.Gid))
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/pkg/locker"
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
|
|
@ -172,6 +172,10 @@ func DriverBenchDiffApplyN(b *testing.B, fileCount int, drivername string, drive
|
|||
b.StopTimer()
|
||||
arch.Close()
|
||||
|
||||
// suppressing "SA9003: empty branch (staticcheck)" instead of commenting-out/removing
|
||||
// these lines because removing/commenting these lines causes a ripple effect
|
||||
// of changes, and there's still a to-do below
|
||||
//nolint:staticcheck
|
||||
if applyDiffSize != diffSize {
|
||||
// TODO: enforce this
|
||||
//b.Fatalf("Apply diff size different, got %d, expected %s", applyDiffSize, diffSize)
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/daemon/graphdriver/quota"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"golang.org/x/sys/unix"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
rsystem "github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/plugingetter"
|
||||
"github.com/docker/docker/pkg/plugins"
|
||||
"github.com/docker/docker/plugin/v2"
|
||||
v2 "github.com/docker/docker/plugin/v2"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/docker/docker/pkg/idtools"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
//nolint:structcheck
|
||||
type driverQuota struct {
|
||||
quotaCtl *quota.Control
|
||||
quotaOpt quota.Quota
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
winio "github.com/Microsoft/go-winio"
|
||||
"github.com/Microsoft/go-winio/archive/tar"
|
||||
"github.com/Microsoft/go-winio/backuptar"
|
||||
"github.com/Microsoft/go-winio/vhd"
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/layer"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/progress"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package images // import "github.com/docker/docker/daemon/images"
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/go-metrics"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
)
|
||||
|
||||
type invalidFilter struct {
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
dockerreference "github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/libtrust"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/go-connections/sockets"
|
||||
"github.com/docker/go-metrics"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ func TestParseInitVersion(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
version, commit, err := parseInitVersion(string(test.output))
|
||||
version, commit, err := parseInitVersion(test.output)
|
||||
if test.invalid {
|
||||
assert.Check(t, is.ErrorContains(err, ""))
|
||||
} else {
|
||||
|
@ -50,7 +50,7 @@ func TestParseInitVersion(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func parseRuncVersion(t *testing.T) {
|
||||
func TestParseRuntimeVersion(t *testing.T) {
|
||||
tests := []struct {
|
||||
output string
|
||||
runtime string
|
||||
|
@ -103,7 +103,7 @@ spec: 1.0.0
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
runtime, version, commit, err := parseRuntimeVersion(string(test.output))
|
||||
runtime, version, commit, err := parseRuntimeVersion(test.output)
|
||||
if test.invalid {
|
||||
assert.Check(t, is.ErrorContains(err, ""))
|
||||
} else {
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/google/uuid"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
"gotest.tools/assert"
|
||||
is "gotest.tools/assert/cmp"
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
winio "github.com/Microsoft/go-winio"
|
||||
"github.com/docker/go-connections/sockets"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package logger // import "github.com/docker/docker/daemon/logger"
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -453,9 +452,9 @@ func piped(b *testing.B, iterations int, delay time.Duration, buf []byte) io.Rea
|
|||
time.Sleep(delay)
|
||||
if n, err := w.Write(buf); err != nil || n != len(buf) {
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
b.Error(err)
|
||||
}
|
||||
b.Fatal(fmt.Errorf("short write"))
|
||||
b.Error("short write")
|
||||
}
|
||||
}
|
||||
w.Close()
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/pkg/plugingetter"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/docker/docker/daemon/logger"
|
||||
"github.com/docker/docker/daemon/logger/loggerutils"
|
||||
"github.com/docker/docker/pkg/urlutil"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/fluent/fluent-logger-golang/fluent"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
const name = "journald"
|
||||
|
||||
type journald struct {
|
||||
mu sync.Mutex
|
||||
mu sync.Mutex //nolint:structcheck,unused
|
||||
vars map[string]string // additional variables and values to send to the journal along with the log message
|
||||
readers map[*logger.LogWatcher]struct{}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/docker/docker/daemon/logger"
|
||||
"github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
|
||||
"github.com/docker/docker/daemon/logger/loggerutils"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
|
@ -188,15 +188,15 @@ func TestJSONFileLoggerWithOpts(t *testing.T) {
|
|||
}
|
||||
|
||||
file, err := os.Open(filename + ".1.gz")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
zipReader, err := gzip.NewReader(file)
|
||||
defer zipReader.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer zipReader.Close()
|
||||
penUlt, err = ioutil.ReadAll(zipReader)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -204,15 +204,15 @@ func TestJSONFileLoggerWithOpts(t *testing.T) {
|
|||
}
|
||||
|
||||
file, err := os.Open(filename + ".2.gz")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer file.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
zipReader, err := gzip.NewReader(file)
|
||||
defer zipReader.Close()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer zipReader.Close()
|
||||
antepenult, err := ioutil.ReadAll(zipReader)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/docker/docker/daemon/logger"
|
||||
"github.com/docker/docker/daemon/logger/loggerutils"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package logger // import "github.com/docker/docker/daemon/logger"
|
||||
|
||||
import (
|
||||
"github.com/docker/go-metrics"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/pkg/plugingetter"
|
||||
"github.com/docker/docker/pkg/plugins"
|
||||
"github.com/docker/go-metrics"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"github.com/docker/docker/pkg/plugingetter"
|
||||
"github.com/docker/docker/pkg/plugins"
|
||||
"github.com/docker/docker/plugin"
|
||||
"github.com/docker/go-metrics"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/unix"
|
||||
|
|
|
@ -202,15 +202,13 @@ func (daemon *Daemon) autoRemove(c *container.Container) {
|
|||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
if err = daemon.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err == nil {
|
||||
err := daemon.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: true, RemoveVolume: true})
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if c := daemon.containers.Get(c.ID); c == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logrus.WithError(err).WithField("container", c.ID).Error("error removing container")
|
||||
}
|
||||
logrus.WithError(err).WithField("container", c.ID).Error("error removing container")
|
||||
}
|
||||
|
|
|
@ -960,12 +960,6 @@ func buildCreateEndpointOptions(c *container.Container, n libnetwork.Network, ep
|
|||
return createOptions, nil
|
||||
}
|
||||
|
||||
// getEndpointInNetwork returns the container's endpoint to the provided network.
|
||||
func getEndpointInNetwork(name string, n libnetwork.Network) (libnetwork.Endpoint, error) {
|
||||
endpointName := strings.TrimPrefix(name, "/")
|
||||
return n.EndpointByName(endpointName)
|
||||
}
|
||||
|
||||
// getSandboxPortMapInfo retrieves the current port-mapping programmed for the given sandbox
|
||||
func getSandboxPortMapInfo(sb libnetwork.Sandbox) nat.PortMap {
|
||||
pm := nat.PortMap{}
|
||||
|
|
13
daemon/network_windows.go
Normal file
13
daemon/network_windows.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package daemon
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/libnetwork"
|
||||
)
|
||||
|
||||
// getEndpointInNetwork returns the container's endpoint to the provided network.
|
||||
func getEndpointInNetwork(name string, n libnetwork.Network) (libnetwork.Endpoint, error) {
|
||||
endpointName := strings.TrimPrefix(name, "/")
|
||||
return n.EndpointByName(endpointName)
|
||||
}
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/containerd/containerd/contrib/nvidia"
|
||||
"github.com/docker/docker/pkg/capabilities"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
"github.com/opencontainers/runc/libcontainer/devices"
|
||||
rsystem "github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/opencontainers/runc/libcontainer/user"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/unix"
|
||||
|
|
|
@ -2,7 +2,7 @@ package daemon // import "github.com/docker/docker/daemon"
|
|||
|
||||
import (
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
func setLinuxDomainname(c *container.Container, s *specs.Spec) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/docker/docker/oci/caps"
|
||||
"github.com/docker/docker/pkg/sysinfo"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/windows/registry"
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/docker/docker/container"
|
||||
swarmagent "github.com/docker/swarmkit/agent"
|
||||
swarmapi "github.com/docker/swarmkit/api"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"golang.org/x/sys/windows/registry"
|
||||
"gotest.tools/assert"
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
coci "github.com/containerd/containerd/oci"
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/profiles/seccomp"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -28,9 +28,9 @@ func WithSeccomp(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
|||
|
||||
if !daemon.seccompEnabled {
|
||||
if c.SeccompProfile != "" && c.SeccompProfile != "unconfined" {
|
||||
return fmt.Errorf("Seccomp is not enabled in your kernel, cannot run a custom seccomp profile.")
|
||||
return fmt.Errorf("seccomp is not enabled in your kernel, cannot run a custom seccomp profile")
|
||||
}
|
||||
logrus.Warn("Seccomp is not enabled in your kernel, running container without default profile.")
|
||||
logrus.Warn("seccomp is not enabled in your kernel, running container without default profile")
|
||||
c.SeccompProfile = "unconfined"
|
||||
}
|
||||
if c.SeccompProfile == "unconfined" {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package daemon // import "github.com/docker/docker/daemon"
|
||||
|
||||
import "github.com/opencontainers/selinux/go-selinux"
|
||||
import selinux "github.com/opencontainers/selinux/go-selinux"
|
||||
|
||||
func selinuxSetDisabled() {
|
||||
selinux.SetDisabled()
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
containertypes "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/go-units"
|
||||
units "github.com/docker/go-units"
|
||||
)
|
||||
|
||||
// ContainerTop handles `docker top` client requests.
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
func toContainerdResources(resources container.Resources) *libcontainerdtypes.Resources {
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
refstore "github.com/docker/docker/reference"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/libtrust"
|
||||
"github.com/opencontainers/go-digest"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/docker/distribution"
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/docker/distribution/registry/api/errcode"
|
||||
"github.com/docker/distribution/registry/api/v2"
|
||||
v2 "github.com/docker/distribution/registry/api/v2"
|
||||
"github.com/docker/distribution/registry/client"
|
||||
"github.com/docker/distribution/registry/client/auth"
|
||||
"github.com/docker/docker/distribution/xfer"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue