diff --git a/cli/compose/loader/volume.go b/cli/compose/loader/volume.go index 9c2792e0f7..f043f4aa57 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 ebe5f6b596..d3c3933176 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