Skip to content

Commit

Permalink
check secret source exists, as bind mount would create target as a fo…
Browse files Browse the repository at this point in the history
…lder otherwise

Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Sep 23, 2024
1 parent ce27dba commit 34b1819
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/compose/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,18 @@ func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount
continue
}

if _, err := os.Stat(definedSecret.File); os.IsNotExist(err) {
logrus.Warnf("secret file %s does not exist", definedSecret.Name)
}

mnt, err := buildMount(p, types.ServiceVolumeConfig{
Type: types.VolumeTypeBind,
Source: definedSecret.File,
Target: target,
ReadOnly: true,
Bind: &types.ServiceVolumeBind{
CreateHostPath: false,
},
})
if err != nil {
return nil, err
Expand Down

0 comments on commit 34b1819

Please sign in to comment.