Skip to content

Commit 7e7262b

Browse files
authored
Merge branch 'docker:v2' into issue#9147
2 parents ced9eba + 981aea6 commit 7e7262b

File tree

18 files changed

+974
-414
lines changed

18 files changed

+974
-414
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
- name: Run golangci-lint
2929
env:
3030
BUILD_TAGS: e2e
31-
run: |
32-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin/ v1.39.0
33-
make -f builder.Makefile lint
31+
uses: golangci/golangci-lint-action@v2
32+
with:
33+
args: --timeout=180s
3434

3535
# only on main branch, costs too much for the gain on every PR
3636
validate-cross-build:

cmd/compose/compose.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,24 +120,6 @@ func (o *projectOptions) WithServices(fn ProjectServicesFunc) func(cmd *cobra.Co
120120
return err
121121
}
122122

123-
if o.EnvFile != "" {
124-
var services types.Services
125-
for _, s := range project.Services {
126-
ef := o.EnvFile
127-
if ef != "" {
128-
if !filepath.IsAbs(ef) {
129-
ef = filepath.Join(project.WorkingDir, o.EnvFile)
130-
}
131-
if s.Labels == nil {
132-
s.Labels = make(map[string]string)
133-
}
134-
s.Labels[api.EnvironmentFileLabel] = ef
135-
services = append(services, s)
136-
}
137-
}
138-
project.Services = services
139-
}
140-
141123
return fn(ctx, project, args)
142124
})
143125
}
@@ -180,6 +162,25 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
180162
compose.Separator = "_"
181163
}
182164

165+
ef := o.EnvFile
166+
if ef != "" && !filepath.IsAbs(ef) {
167+
ef = filepath.Join(project.WorkingDir, o.EnvFile)
168+
}
169+
for i, s := range project.Services {
170+
s.CustomLabels = map[string]string{
171+
api.ProjectLabel: project.Name,
172+
api.ServiceLabel: s.Name,
173+
api.VersionLabel: api.ComposeVersion,
174+
api.WorkingDirLabel: project.WorkingDir,
175+
api.ConfigFilesLabel: strings.Join(project.ComposeFiles, ","),
176+
api.OneoffLabel: "False", // default, will be overridden by `run` command
177+
}
178+
if ef != "" {
179+
s.CustomLabels[api.EnvironmentFileLabel] = ef
180+
}
181+
project.Services[i] = s
182+
}
183+
183184
if len(services) > 0 {
184185
s, err := project.GetServices(services...)
185186
if err != nil {

cmd/compose/down.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import (
2222
"time"
2323

2424
"github.com/compose-spec/compose-go/types"
25+
"github.com/sirupsen/logrus"
2526
"github.com/spf13/cobra"
27+
"github.com/spf13/pflag"
2628

2729
"github.com/docker/compose/v2/pkg/api"
2830
)
@@ -62,6 +64,14 @@ func downCommand(p *projectOptions, backend api.Service) *cobra.Command {
6264
flags.IntVarP(&opts.timeout, "timeout", "t", 10, "Specify a shutdown timeout in seconds")
6365
flags.BoolVarP(&opts.volumes, "volumes", "v", false, " Remove named volumes declared in the `volumes` section of the Compose file and anonymous volumes attached to containers.")
6466
flags.StringVar(&opts.images, "rmi", "", `Remove images used by services. "local" remove only images that don't have a custom tag ("local"|"all")`)
67+
flags.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
68+
switch name {
69+
case "volume":
70+
name = "volumes"
71+
logrus.Warn("--volume is deprecated, please use --volumes")
72+
}
73+
return pflag.NormalizedName(name)
74+
})
6575
return downCmd
6676
}
6777

cmd/compose/list.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,24 @@ func runList(ctx context.Context, backend api.Service, opts lsOptions) error {
9292
view := viewFromStackList(stackList)
9393
return formatter.Print(view, opts.Format, os.Stdout, func(w io.Writer) {
9494
for _, stack := range view {
95-
_, _ = fmt.Fprintf(w, "%s\t%s\n", stack.Name, stack.Status)
95+
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\n", stack.Name, stack.Status, stack.ConfigFiles)
9696
}
97-
}, "NAME", "STATUS")
97+
}, "NAME", "STATUS", "CONFIG FILES")
9898
}
9999

100100
type stackView struct {
101-
Name string
102-
Status string
101+
Name string
102+
Status string
103+
ConfigFiles string
103104
}
104105

105106
func viewFromStackList(stackList []api.Stack) []stackView {
106107
retList := make([]stackView, len(stackList))
107108
for i, s := range stackList {
108109
retList[i] = stackView{
109-
Name: s.Name,
110-
Status: strings.TrimSpace(fmt.Sprintf("%s %s", s.Status, s.Reason)),
110+
Name: s.Name,
111+
Status: strings.TrimSpace(fmt.Sprintf("%s %s", s.Status, s.Reason)),
112+
ConfigFiles: s.ConfigFiles,
111113
}
112114
}
113115
return retList

docs/reference/compose_up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Builds, (re)creates, starts, and attaches to containers for a service.
55

66
Unless they are already running, this command also starts any linked services.
77

8-
The `docker compose up` command aggregates the output of each container (liked `docker compose logs --follow` does).
8+
The `docker compose up` command aggregates the output of each container (like `docker compose logs --follow` does).
99
When the command exits, all containers are stopped. Running `docker compose up --detach` starts the containers in the
1010
background and leaves them running.
1111

docs/reference/docker_compose_up.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ long: |-
55
66
Unless they are already running, this command also starts any linked services.
77
8-
The `docker compose up` command aggregates the output of each container (liked `docker compose logs --follow` does).
8+
The `docker compose up` command aggregates the output of each container (like `docker compose logs --follow` does).
99
When the command exits, all containers are stopped. Running `docker compose up --detach` starts the containers in the
1010
background and leaves them running.
1111

docs/yaml/main/generate.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,16 @@ func generateCliYaml(opts *options) error {
3232
disableFlagsInUseLine(cmd)
3333

3434
cmd.DisableAutoGenTag = true
35-
return clidocstool.GenYamlTree(cmd, opts.target)
35+
tool, err := clidocstool.New(clidocstool.Options{
36+
Root: cmd,
37+
SourceDir: opts.source,
38+
TargetDir: opts.target,
39+
Plugin: true,
40+
})
41+
if err != nil {
42+
return err
43+
}
44+
return tool.GenYamlTree(cmd)
3645
}
3746

3847
func disableFlagsInUseLine(cmd *cobra.Command) {

go.mod

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ go 1.17
44

55
require (
66
github.com/AlecAivazis/survey/v2 v2.3.2
7-
github.com/buger/goterm v1.0.1
7+
github.com/buger/goterm v1.0.4
88
github.com/cnabio/cnab-to-oci v0.3.1-beta1
9-
github.com/compose-spec/compose-go v1.0.9-0.20220101154228-91ed80f52afe
9+
github.com/compose-spec/compose-go v1.0.9
1010
github.com/containerd/console v1.0.3
1111
github.com/containerd/containerd v1.5.8
1212
github.com/distribution/distribution/v3 v3.0.0-20210316161203-a01c71e2477e
13-
github.com/docker/buildx v0.5.2-0.20210422185057-908a856079fc
14-
github.com/docker/cli v20.10.7+incompatible
15-
github.com/docker/cli-docs-tool v0.1.1
13+
github.com/docker/buildx v0.7.1
14+
github.com/docker/cli v20.10.12+incompatible
15+
github.com/docker/cli-docs-tool v0.2.1
1616
github.com/docker/docker v20.10.7+incompatible
1717
github.com/docker/go-connections v0.4.0
1818
github.com/docker/go-units v0.4.0
@@ -21,7 +21,7 @@ require (
2121
github.com/hashicorp/go-version v1.3.0
2222
github.com/mattn/go-isatty v0.0.14
2323
github.com/mattn/go-shellwords v1.0.12
24-
github.com/moby/buildkit v0.8.2-0.20210401015549-df49b648c8bf
24+
github.com/moby/buildkit v0.9.1-0.20211019185819-8778943ac3da
2525
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
2626
github.com/morikuni/aec v1.0.0
2727
github.com/opencontainers/go-digest v1.0.0
@@ -34,48 +34,43 @@ require (
3434
github.com/stretchr/testify v1.7.0
3535
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
3636
gotest.tools v2.2.0+incompatible
37-
gotest.tools/v3 v3.0.3
37+
gotest.tools/v3 v3.1.0
3838
)
3939

4040
require (
4141
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
4242
github.com/Masterminds/semver v1.5.0 // indirect
43-
github.com/Microsoft/go-winio v0.4.17 // indirect
44-
github.com/Microsoft/hcsshim v0.8.23 // indirect
43+
github.com/Microsoft/go-winio v0.5.0 // indirect
4544
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
4645
github.com/beorn7/perks v1.0.1 // indirect
4746
github.com/cespare/xxhash/v2 v2.1.2 // indirect
4847
github.com/cnabio/cnab-go v0.10.0-beta1 // indirect
49-
github.com/compose-spec/godotenv v1.1.1 // indirect
50-
github.com/containerd/cgroups v1.0.1 // indirect
5148
github.com/containerd/continuity v0.1.0 // indirect
5249
github.com/containerd/typeurl v1.0.2 // indirect
5350
github.com/davecgh/go-spew v1.1.1 // indirect
5451
github.com/docker/distribution v2.7.1+incompatible // indirect
55-
github.com/docker/docker-credential-helpers v0.6.4-0.20210125172408-38bea2ce277a // indirect
52+
github.com/docker/docker-credential-helpers v0.6.4 // indirect
5653
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
5754
github.com/docker/go-metrics v0.0.1 // indirect
55+
github.com/felixge/httpsnoop v1.0.2 // indirect
5856
github.com/fvbommel/sortorder v1.0.1 // indirect
5957
github.com/go-logr/logr v0.4.0 // indirect
6058
github.com/gofrs/flock v0.8.0 // indirect
6159
github.com/gogo/googleapis v1.4.0 // indirect
6260
github.com/gogo/protobuf v1.3.2 // indirect
63-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
6461
github.com/golang/protobuf v1.5.2 // indirect
6562
github.com/google/go-cmp v0.5.6 // indirect
6663
github.com/google/gofuzz v1.1.0 // indirect
6764
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
6865
github.com/gorilla/mux v1.8.0 // indirect
6966
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 // indirect
70-
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
67+
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
7168
github.com/hashicorp/errwrap v1.0.0 // indirect
7269
github.com/imdario/mergo v0.3.12 // indirect
7370
github.com/inconshreveable/mousetrap v1.0.0 // indirect
74-
github.com/jaguilar/vt100 v0.0.0-20150826170717-2703a27b14ea // indirect
7571
github.com/json-iterator/go v1.1.12 // indirect
7672
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
77-
github.com/klauspost/compress v1.11.13 // indirect
78-
github.com/kr/pty v1.1.8 // indirect
73+
github.com/klauspost/compress v1.13.5 // indirect
7974
github.com/mattn/go-colorable v0.1.12 // indirect
8075
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
8176
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
@@ -84,47 +79,65 @@ require (
8479
github.com/moby/locker v1.0.1 // indirect
8580
github.com/moby/sys/mount v0.2.0 // indirect
8681
github.com/moby/sys/mountinfo v0.4.1 // indirect
82+
github.com/moby/sys/signal v0.5.0 // indirect
8783
github.com/moby/sys/symlink v0.1.0 // indirect
8884
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
8985
github.com/modern-go/reflect2 v1.0.2 // indirect
9086
github.com/opencontainers/runc v1.0.2 // indirect
91-
github.com/opentracing/opentracing-go v1.2.0 // indirect
87+
github.com/pelletier/go-toml v1.9.4 // indirect
9288
github.com/pmezard/go-difflib v1.0.0 // indirect
93-
github.com/prometheus/client_golang v1.7.1 // indirect
89+
github.com/prometheus/client_golang v1.11.0 // indirect
9490
github.com/prometheus/client_model v0.2.0 // indirect
95-
github.com/prometheus/common v0.10.0 // indirect
91+
github.com/prometheus/common v0.26.0 // indirect
9692
github.com/prometheus/procfs v0.6.0 // indirect
9793
github.com/qri-io/jsonpointer v0.1.0 // indirect
9894
github.com/qri-io/jsonschema v0.1.1 // indirect
9995
github.com/sergi/go-diff v1.1.0 // indirect
10096
github.com/theupdateframework/notary v0.6.1 // indirect
101-
github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85 // indirect
97+
github.com/tonistiigi/fsutil v0.0.0-20210818161904-4442383b5028 // indirect
10298
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
99+
github.com/tonistiigi/vt100 v0.0.0-20210615222946-8066bb97264f // indirect
103100
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
104101
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
105102
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
106-
go.opencensus.io v0.23.0 // indirect
103+
go.opentelemetry.io/contrib v0.21.0 // indirect
104+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.21.0 // indirect
105+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.21.0 // indirect
106+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.21.0 // indirect
107+
go.opentelemetry.io/otel v1.0.0-RC1 // indirect
108+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC1 // indirect
109+
go.opentelemetry.io/otel/internal/metric v0.21.0 // indirect
110+
go.opentelemetry.io/otel/metric v0.21.0 // indirect
111+
go.opentelemetry.io/otel/sdk v1.0.0-RC1 // indirect
112+
go.opentelemetry.io/otel/trace v1.0.0-RC1 // indirect
113+
go.opentelemetry.io/proto/otlp v0.9.0 // indirect
107114
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
108115
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
109116
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
110117
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
111118
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
112119
golang.org/x/text v0.3.7 // indirect
113-
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
120+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
114121
google.golang.org/appengine v1.6.7 // indirect
115122
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
116123
google.golang.org/grpc v1.42.0 // indirect
117124
google.golang.org/protobuf v1.27.1 // indirect
118125
gopkg.in/inf.v0 v0.9.1 // indirect
119126
gopkg.in/yaml.v2 v2.4.0 // indirect
120127
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
121-
k8s.io/apimachinery v0.21.0 // indirect
122-
k8s.io/client-go v0.21.0 // indirect
123-
k8s.io/klog/v2 v2.8.0 // indirect
124-
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
125-
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
128+
k8s.io/apimachinery v0.22.1 // indirect
129+
k8s.io/client-go v0.22.1 // indirect
130+
k8s.io/klog/v2 v2.9.0 // indirect
131+
k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9 // indirect
132+
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
126133
sigs.k8s.io/yaml v1.2.0 // indirect
127134
)
128135

129136
// (for buildx)
130-
replace github.com/jaguilar/vt100 => github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305
137+
replace (
138+
github.com/docker/cli => github.com/docker/cli v20.10.3-0.20210702143511-f782d1355eff+incompatible
139+
github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220121014307-40bb9831756f+incompatible
140+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc => github.com/tonistiigi/opentelemetry-go-contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.0.0-20210714055410-d010b05b4939
141+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace => github.com/tonistiigi/opentelemetry-go-contrib/instrumentation/net/http/httptrace/otelhttptrace v0.0.0-20210714055410-d010b05b4939
142+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => github.com/tonistiigi/opentelemetry-go-contrib/instrumentation/net/http/otelhttp v0.0.0-20210714055410-d010b05b4939
143+
)

0 commit comments

Comments
 (0)