You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bind.parse() fails to handle Windows-style absolute paths with drive letters #2479
When using Bind.parse() on Windows, if the bind string contains an absolute path with a drive letter (e.g. G:/path/to/folder:/container/path:rw), it fails with IllegalArgumentException due to incorrect parsing of the colon : in the drive letter.
java.lang.IllegalArgumentException: Error parsing Bind 'G:/zzcoder-judger-work/304bdf33-8970-4e06-a3d1-e10b7f162960:/app:rw'
at com.github.dockerjava.api.model.Bind.parse(Bind.java:...)
...
This is because Bind.parse() internally uses split(":(?!\\\\)"), which incorrectly splits the drive letter (G:) as a separate part, resulting in a malformed array of parts like:
Bind.parse() should handle valid Windows-style absolute paths that contain a colon (:) as part of the drive letter (e.g. C:/..., D:/..., etc.) and not split them incorrectly.
Environment
OS: Windows 11
docker-java version: 3.4.0
Java version: 17
Suggested Fix
Consider improving the parser logic in Bind.parse() to:
Recognize Windows drive letters and handle them gracefully.
Avoid blindly splitting on : without checking the context.
Possibly introduce an overloaded method or helper for cross-platform compatibility.
Thanks for your support and for maintaining this useful library!
When using docker-java to mount a directory on Windows, passing a non-standard path format like "G:/path" instead of the Windows-compliant "G:\\path" leads to a parsing failure inside the Bind.parse(String serialized) method.
Specifically, this line in the source code:
String[] parts = serialized.split(":(?!\\\\)");
was intended to avoid splitting drive letters like G:\, but it does not account for users writing paths like G:/path (which is not strictly Windows-compliant, but still commonly used in Java apps). As a result, the parser incorrectly splits the string and throws an exception such as:
Activity
zazhiii commentedon Jul 17, 2025
🐛 Bug 描述(Bug Description)
When using
docker-javato mount a directory on Windows, passing a non-standard path format like"G:/path"instead of the Windows-compliant"G:\\path"leads to a parsing failure inside theBind.parse(String serialized)method.Specifically, this line in the source code:
was intended to avoid splitting drive letters like
G:\, but it does not account for users writing paths likeG:/path(which is not strictly Windows-compliant, but still commonly used in Java apps). As a result, the parser incorrectly splits the string and throws an exception such as: