Skip to content

Commit 34b1819

Browse files
committed
check secret source exists, as bind mount would create target as a folder otherwise
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent ce27dba commit 34b1819

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/compose/create.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,11 +1003,18 @@ func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount
10031003
continue
10041004
}
10051005

1006+
if _, err := os.Stat(definedSecret.File); os.IsNotExist(err) {
1007+
logrus.Warnf("secret file %s does not exist", definedSecret.Name)
1008+
}
1009+
10061010
mnt, err := buildMount(p, types.ServiceVolumeConfig{
10071011
Type: types.VolumeTypeBind,
10081012
Source: definedSecret.File,
10091013
Target: target,
10101014
ReadOnly: true,
1015+
Bind: &types.ServiceVolumeBind{
1016+
CreateHostPath: false,
1017+
},
10111018
})
10121019
if err != nil {
10131020
return nil, err

0 commit comments

Comments
 (0)