Skip to content

Commit

Permalink
fix: Fix --env-file flag behavior in nerdctl compose
Browse files Browse the repository at this point in the history
Signed-off-by: Arjun Raja Yogidas <[email protected]>
  • Loading branch information
coderbirju committed Dec 4, 2024
1 parent 1f8fe6a commit d413058
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/command-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ Flags:
- :whale: `-p, --project-name`: Specify an alternate project name
- :nerd_face: `--ipfs-address`: Multiaddr of IPFS API (default uses `$IPFS_PATH` env variable if defined or local directory `~/.ipfs`)
- :whale: `--profile: Specify a profile to enable
- :whale: `--env-file` : Specify an alternate environment file

### :whale: nerdctl compose up

Expand Down
4 changes: 4 additions & 0 deletions pkg/composer/up_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ func (c *Composer) upServiceContainer(ctx context.Context, service *serviceparse
defer os.RemoveAll(tempDir)
cidFilename := filepath.Join(tempDir, "cid")

if c.EnvFile != "" {
container.RunArgs = append([]string{"--env-file=" + c.EnvFile}, container.RunArgs...)
}

//add metadata labels to container https://github.com/compose-spec/compose-spec/blob/master/spec.md#labels
container.RunArgs = append([]string{
"--cidfile=" + cidFilename,
Expand Down

0 comments on commit d413058

Please sign in to comment.