Skip to content

Commit 0c0737d

Browse files
authored
Merge pull request containerd#3703 from coderbirju/fix-env-file-bug
fix: enable --env-file flag behavior in nerdctl compose
2 parents 1f8fe6a + d413058 commit 0c0737d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/command-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ Flags:
13911391
- :whale: `-p, --project-name`: Specify an alternate project name
13921392
- :nerd_face: `--ipfs-address`: Multiaddr of IPFS API (default uses `$IPFS_PATH` env variable if defined or local directory `~/.ipfs`)
13931393
- :whale: `--profile: Specify a profile to enable
1394+
- :whale: `--env-file` : Specify an alternate environment file
13941395

13951396
### :whale: nerdctl compose up
13961397

pkg/composer/up_service.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ func (c *Composer) upServiceContainer(ctx context.Context, service *serviceparse
175175
defer os.RemoveAll(tempDir)
176176
cidFilename := filepath.Join(tempDir, "cid")
177177

178+
if c.EnvFile != "" {
179+
container.RunArgs = append([]string{"--env-file=" + c.EnvFile}, container.RunArgs...)
180+
}
181+
178182
//add metadata labels to container https://github.com/compose-spec/compose-spec/blob/master/spec.md#labels
179183
container.RunArgs = append([]string{
180184
"--cidfile=" + cidFilename,

0 commit comments

Comments
 (0)