Skip to content

Commit 0c1a691

Browse files
authored
fix container being recreated while config has not changed (docker#10540)
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent f72d5d6 commit 0c1a691

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

cmd/compose/compose.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (o *ProjectOptions) WithProject(fn ProjectFunc) func(cmd *cobra.Command, ar
119119
// WithServices creates a cobra run command from a ProjectFunc based on configured project options and selected services
120120
func (o *ProjectOptions) WithServices(fn ProjectServicesFunc) func(cmd *cobra.Command, args []string) error {
121121
return Adapt(func(ctx context.Context, args []string) error {
122-
project, err := o.ToProject(args, cli.WithResolvedPaths(true))
122+
project, err := o.ToProject(args, cli.WithResolvedPaths(true), cli.WithDiscardEnvFile)
123123
if err != nil {
124124
return err
125125
}
@@ -143,7 +143,7 @@ func (o *ProjectOptions) projectOrName(services ...string) (*types.Project, stri
143143
name := o.ProjectName
144144
var project *types.Project
145145
if len(o.ConfigPaths) > 0 || o.ProjectName == "" {
146-
p, err := o.ToProject(services)
146+
p, err := o.ToProject(services, cli.WithDiscardEnvFile)
147147
if err != nil {
148148
envProjectName := os.Getenv("COMPOSE_PROJECT_NAME")
149149
if envProjectName != "" {

cmd/compose/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func runCommand(p *ProjectOptions, streams api.Streams, backend api.Service) *co
142142
return nil
143143
}),
144144
RunE: Adapt(func(ctx context.Context, args []string) error {
145-
project, err := p.ToProject([]string{opts.Service}, cgo.WithResolvedPaths(true))
145+
project, err := p.ToProject([]string{opts.Service}, cgo.WithResolvedPaths(true), cgo.WithDiscardEnvFile)
146146
if err != nil {
147147
return err
148148
}

0 commit comments

Comments
 (0)