@@ -22,7 +22,6 @@ import (
2222 "context"
2323 "fmt"
2424 "strconv"
25- "strings"
2625 "time"
2726
2827 "github.com/compose-spec/compose-go/v2/types"
@@ -46,7 +45,6 @@ func (s *composeService) injectConfigs(ctx context.Context, project *types.Proje
4645
4746func (s * composeService ) injectFileReferences (ctx context.Context , project * types.Project , service types.ServiceConfig , id string , mountType mountType ) error {
4847 mounts , sources := s .getFilesAndMap (project , service , mountType )
49- var ctrConfig * container.Config
5048
5149 for _ , mount := range mounts {
5250 content , err := s .resolveFileContent (project , sources [mount .Source ], mountType )
@@ -63,11 +61,6 @@ func (s *composeService) injectFileReferences(ctx context.Context, project *type
6361
6462 s .setDefaultTarget (& mount , mountType )
6563
66- ctrConfig , err = s .setFileOwnership (ctx , id , & mount , ctrConfig )
67- if err != nil {
68- return err
69- }
70-
7164 if err := s .copyFileToContainer (ctx , id , content , mount ); err != nil {
7265 return err
7366 }
@@ -129,30 +122,6 @@ func (s *composeService) setDefaultTarget(file *types.FileReferenceConfig, mount
129122 }
130123}
131124
132- func (s * composeService ) setFileOwnership (ctx context.Context , id string , file * types.FileReferenceConfig , ctrConfig * container.Config ) (* container.Config , error ) {
133- if file .UID != "" || file .GID != "" {
134- return ctrConfig , nil
135- }
136-
137- if ctrConfig == nil {
138- ctr , err := s .apiClient ().ContainerInspect (ctx , id )
139- if err != nil {
140- return nil , err
141- }
142- ctrConfig = ctr .Config
143- }
144-
145- parts := strings .Split (ctrConfig .User , ":" )
146- if len (parts ) > 0 {
147- file .UID = parts [0 ]
148- }
149- if len (parts ) > 1 {
150- file .GID = parts [1 ]
151- }
152-
153- return ctrConfig , nil
154- }
155-
156125func (s * composeService ) copyFileToContainer (ctx context.Context , id , content string , file types.FileReferenceConfig ) error {
157126 b , err := createTar (content , file )
158127 if err != nil {
0 commit comments