diff --git a/cli/compose/loader/volume.go b/cli/compose/loader/volume.go index 9c2792e0f7dc..f043f4aa57ff 100644 --- a/cli/compose/loader/volume.go +++ b/cli/compose/loader/volume.go @@ -111,6 +111,9 @@ func isFilePath(source string) bool { case '.', '/', '~': return true } + if len([]rune(source)) == 1 { + return false + } // windows named pipes if strings.HasPrefix(source, `\\`) { diff --git a/cli/compose/loader/volume_test.go b/cli/compose/loader/volume_test.go index 7be0411db9aa..b42be1fc5209 100644 --- a/cli/compose/loader/volume_test.go +++ b/cli/compose/loader/volume_test.go @@ -162,6 +162,8 @@ func TestParseVolumeWindowsNamedPipe(t *testing.T) { func TestIsFilePath(t *testing.T) { assert.Check(t, !isFilePath("a界")) + assert.Check(t, !isFilePath("1")) + assert.Check(t, !isFilePath("c")) } // Preserve the test cases for VolumeSplitN