-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix stack compose bind-mount volumes for Windows #136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
Unfortunately doing this on the client side just does not work at all. |
@cpuguy83 I believe this works correctly on the client. The last one (bind mount source path) is also a path relative to the client, so I think that's correct as well. |
This should never be a path relative to the client. Works great for compose as a relative path, does not really work on a swarm. I'm also wondering how this affects docker4windows (windows client -> linux daemon). |
What about when there is a single swarm node which is the localhost? Then local paths are just fine. We need to continue to support that workflow. In every other case a client path will be wrong, so the user should use an absolute path. |
Sure we need to continue to support it but not in a cluster API.
…On Tue, May 30, 2017 at 4:13 PM, Daniel Nephin ***@***.***> wrote:
This should never be a path relative to the client.
What about when there is a single swarm node which is the localhost? Then
local paths are just fine. We need to continue to support that workflow.
In every other case a client path will be wrong, so the user should use an
absolute path.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#136 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAwxZhmFbbEXF82d-cxrHOwd07xUyb5Aks5r_HhjgaJpZM4Noctq>
.
--
- Brian Goff
|
To clarify. I meant we need to continue to support it for |
4b69834
to
e83a338
Compare
This fix makes it possible to bind-mount volumes in stacks from the Windows client. I verified this works with Windows Server 2016 containers, and with Docker for Windows with Linux containers. I tried to verify Windows containers as well, but am encountering an unrelated HNS error. Regardless, I can see that this corrects the problem by inspecting the service created for the stack. However, this does not handle a Windows client creating a stack service from a Linux daemon, where the volume source path is a directory local to the daemon system. In the Docker for Windows case, that would be bind-mounting a volume from within the LinuxKit VM (normally the Windows path is translated automatically); the client working directory is irrelevant in that case. As @cpuguy83 suggested earlier (offline), it might be reasonable for the client to check for both Linux and Windows absolute paths. |
For stack compose files, use filepath.IsAbs instead of path.IsAbs, for bind-mounted service volumes, because filepath.IsAbs handles Windows paths, while path.IsAbs does not. Signed-off-by: John Stephens <johnstep@docker.com>
e83a338
to
9043d39
Compare
I updated this to do a Unix absolute path check first (via the previous check, |
Codecov Report
@@ Coverage Diff @@
## master #136 +/- ##
==========================================
- Coverage 44.96% 44.85% -0.11%
==========================================
Files 169 169
Lines 11378 11379 +1
==========================================
- Hits 5116 5104 -12
- Misses 5970 5982 +12
- Partials 292 293 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this works for now, but note that path
really only applies to strings with /
separators and not really unix paths specifically... however path.IsAbs
and the unix implementation of filepath.IsAbs
are essentially the same.
@cpuguy83 Yes, true. A better solution might be to add a function that specifically checks for an absolute path on any platform, if that can be done in a reasonable way. On a side note, the code that handles |
For stack compose files, use filepath.IsAbs instead of path.IsAbs, for
bind-mounted service volumes, because filepath.IsAbs handles Windows
paths, while path.IsAbs does not.
Signed-off-by: John Stephens johnstep@docker.com