mirror of
https://github.com/docker/compose.git
synced 2025-07-23 21:54:40 +02:00
don't use filepath to process remote bind paths
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
d625f08a70
commit
dc036c2686
@ -618,9 +618,9 @@ func buildContainerConfigMounts(p types.Project, s types.ServiceConfig) ([]mount
|
|||||||
for _, config := range s.Configs {
|
for _, config := range s.Configs {
|
||||||
target := config.Target
|
target := config.Target
|
||||||
if config.Target == "" {
|
if config.Target == "" {
|
||||||
target = filepath.Join(configsBaseDir, config.Source)
|
target = configsBaseDir + config.Source
|
||||||
} else if !filepath.IsAbs(config.Target) {
|
} else if !isUnixAbs(config.Target) {
|
||||||
target = filepath.Join(configsBaseDir, config.Target)
|
target = configsBaseDir + config.Target
|
||||||
}
|
}
|
||||||
|
|
||||||
definedConfig := p.Configs[config.Source]
|
definedConfig := p.Configs[config.Source]
|
||||||
@ -649,13 +649,13 @@ func buildContainerConfigMounts(p types.Project, s types.ServiceConfig) ([]mount
|
|||||||
func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount.Mount, error) {
|
func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount.Mount, error) {
|
||||||
var mounts = map[string]mount.Mount{}
|
var mounts = map[string]mount.Mount{}
|
||||||
|
|
||||||
secretsDir := "/run/secrets"
|
secretsDir := "/run/secrets/"
|
||||||
for _, secret := range s.Secrets {
|
for _, secret := range s.Secrets {
|
||||||
target := secret.Target
|
target := secret.Target
|
||||||
if secret.Target == "" {
|
if secret.Target == "" {
|
||||||
target = filepath.Join(secretsDir, secret.Source)
|
target = secretsDir + secret.Source
|
||||||
} else if !filepath.IsAbs(secret.Target) {
|
} else if !isUnixAbs(secret.Target) {
|
||||||
target = filepath.Join(secretsDir, secret.Target)
|
target = secretsDir + secret.Target
|
||||||
}
|
}
|
||||||
|
|
||||||
definedSecret := p.Secrets[secret.Source]
|
definedSecret := p.Secrets[secret.Source]
|
||||||
@ -681,6 +681,10 @@ func buildContainerSecretMounts(p types.Project, s types.ServiceConfig) ([]mount
|
|||||||
return values, nil
|
return values, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isUnixAbs(path string) bool {
|
||||||
|
return strings.HasPrefix(path, "/")
|
||||||
|
}
|
||||||
|
|
||||||
func buildMount(project types.Project, volume types.ServiceVolumeConfig) (mount.Mount, error) {
|
func buildMount(project types.Project, volume types.ServiceVolumeConfig) (mount.Mount, error) {
|
||||||
source := volume.Source
|
source := volume.Source
|
||||||
if volume.Type == types.VolumeTypeBind && !filepath.IsAbs(source) {
|
if volume.Type == types.VolumeTypeBind && !filepath.IsAbs(source) {
|
||||||
@ -699,7 +703,6 @@ func buildMount(project types.Project, volume types.ServiceVolumeConfig) (mount.
|
|||||||
source = pVolume.Name
|
source = pVolume.Name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mount.Mount{
|
return mount.Mount{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user