@@ -136,21 +136,34 @@ func configCommand(p *ProjectOptions, dockerCli command.Cli) *cobra.Command {
136
136
}
137
137
138
138
func runConfig (ctx context.Context , dockerCli command.Cli , opts configOptions , services []string ) error {
139
- model , err := opts .ToModel (ctx , dockerCli , services )
140
- if err != nil {
141
- return err
142
- }
143
-
144
- if opts .resolveImageDigests {
145
- err = resolveImageDigests (ctx , dockerCli , model )
139
+ var content []byte
140
+ if opts .noInterpolate {
141
+ // we can't use ToProject, so the model we render here is only partially resolved
142
+ model , err := opts .ToModel (ctx , dockerCli , services )
146
143
if err != nil {
147
144
return err
148
145
}
149
- }
150
146
151
- content , err := formatModel (model , opts .Format )
152
- if err != nil {
153
- return err
147
+ if opts .resolveImageDigests {
148
+ err = resolveImageDigests (ctx , dockerCli , model )
149
+ if err != nil {
150
+ return err
151
+ }
152
+ }
153
+
154
+ content , err = formatModel (model , opts .Format )
155
+ if err != nil {
156
+ return err
157
+ }
158
+ } else {
159
+ project , err := opts .ToProject (ctx , dockerCli , services )
160
+ if err != nil {
161
+ return err
162
+ }
163
+ content , err = project .MarshalYAML ()
164
+ if err != nil {
165
+ return err
166
+ }
154
167
}
155
168
156
169
if ! opts .noInterpolate {
@@ -164,7 +177,7 @@ func runConfig(ctx context.Context, dockerCli command.Cli, opts configOptions, s
164
177
if opts .Output != "" && len (content ) > 0 {
165
178
return os .WriteFile (opts .Output , content , 0o666 )
166
179
}
167
- _ , err = fmt .Fprint (dockerCli .Out (), string (content ))
180
+ _ , err : = fmt .Fprint (dockerCli .Out (), string (content ))
168
181
return err
169
182
}
170
183
0 commit comments