Skip to content
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

Add support for "Docker for Windows" #532

Merged
merged 1 commit into from
Sep 15, 2016
Merged

Conversation

jan-zajic
Copy link
Contributor

This PR adds support for new Docker for Windows on Windows 10 (not docker toolbox, see https://docs.docker.com/engine/installation/windows/). This version of docker exposes api through windows named pipe //./pipe/docker_engine. Currently yours maven plugin don't support this condition.

I added support for it, it's work at my machine, but you must set new configuration property "docker.machine.ignoreEmpty" to true, because windows docker don't expose any docker machine after installation.

@jan-zajic
Copy link
Contributor Author

I disable pooling for this type of connection, because i don't known if it's safe and i have some problems with it.

@rhuss
Copy link
Collaborator

rhuss commented Aug 2, 2016

Thanks a lot !

w.r.t to pooling, we indeed have some issues with the Unix socket. Could be that they are resolved, too, when pooling is disabled. But it could also be that there are concurrency issues, not so sure ( #259 has more info about this).

I hope I can review and integrate your PR this week, but not sure, because right before PTO are are quite busy times ;-)

@@ -54,7 +68,7 @@
public static final String CONTEXT_KEY_PREVIOUSLY_PULLED = "CONTEXT_KEY_PREVIOUSLY_PULLED";

// Minimal API version, independent of any feature used
public static final String API_VERSION = "1.18";
public static final String API_VERSION = "v1.18";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its correct without "v" because the "v" is added later to the version -->

access = new DockerAccessWithHcClient("v" + version, dockerUrl,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i see it now, i modify my test integration instead

@rhuss
Copy link
Collaborator

rhuss commented Aug 3, 2016

I disable pooling for this type of connection, because i don't known if it's safe and i have some problems with it.

Good point, I probably should do this for the Unix client as well. Might solve some of the issue we have with that (like in #259)

@rhuss
Copy link
Collaborator

rhuss commented Aug 3, 2016

I added support for it, it's work at my machine, but you must set new configuration property "docker.machine.ignoreEmpty" to true, because windows docker don't expose any docker machine after installation.

Sorry, I didn't fully get this. If you don't configure a docker-machine (either in the plugin configuration or with properties), then docker machine will not be run at all. So, if you use a socket / pipe / TCP connection and leave out this configuration you should be save. I suggest that instead of introducing a new property here, simply don't add a docker-machine configuration in your use case (or work with profiles if you need to switch it on temporarily).

@rhuss
Copy link
Collaborator

rhuss commented Aug 3, 2016

LGTM, I will include it in the over-next version (need to make a release today).

Thanks a lot, its really a very useful contribution.

Beside the minor points above which we should discuss, could you please:

Thanks !


@Override
public void connect(SocketAddress endpoint, int timeout) throws IOException {
if (endpoint == null) {
Copy link
Collaborator

@rhuss rhuss Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need a nullpointer check here. First my IDE says it never can be null (don't know how it know this ;-) but more important it will throw a NPE 10 lines later anyway (if so)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK i removed it.

@jan-zajic
Copy link
Contributor Author

@rhuss about docker.machine.ignoreEmpty - i think that docker-machine is called at startup in DockerConnectionDetector, but now i can see that only if docker.machine.name is configured? I removed this stuff and test at my site as soon as possible.

…commit

Signed-off-by: Jan Zajíc <jan.zajic@corpus.cz>
@jan-zajic
Copy link
Contributor Author

OK, i do fixes based on your comments and squashed and signed commit.

@rhuss
Copy link
Collaborator

rhuss commented Aug 4, 2016

cool, thanks a lot !

@flungo
Copy link

flungo commented Aug 4, 2016

Does this include support for the wincreds credsStore? See https://github.com/docker/docker-credential-helpers/blob/master/wincred/wincred_windows.go

Setting DOCKER_HOST got this plugin working with the latest "Docker for Windows" but I had to pull the images before being able to run.

This may require a new issue if this plugin does not support credsStores at all for that functionality to be implemented.

@rhuss
Copy link
Collaborator

rhuss commented Aug 5, 2016

Tbh, I'm not a Windows user and even need some extra setup for testing this. This PR does not include support for the Windows Credential Manager API. Of course we could add one, however for this we would need to find a Java API for this. If you have any pointer or idea how to access the credential manager, this would be very helpful.

I guess the credential manager is not only used for pull authentication but also for push, or ?

@arielcarrera
Copy link

I have windows 10 and "docker for windows" installed... have you got any snapshot to try it?

@flungo
Copy link

flungo commented Aug 6, 2016

@rhuss Not really a windows user either, but got people developing on Windows where I work and using this plugin for several of our projects, however, credential helpers seems to be another one of the ways Docker is looking to modularize its implementation. In the docker-credential-helpers repo you can see that there are also helpers for secretsservice and osxkeychain. Since this PR/issue is for the auto-detection of the windows socket and that implementing full support for credential helpers is probably a larger task, I will open a new issue for that functionality.

@jan-zajic
Copy link
Contributor Author

@arielcarrera you can clone my branch, git clone https://github.com/jan-zajic/docker-maven-plugin.git, go into that cloned directory (cd docker-maven-plugin), build it: mvn install. Than you can use it in your pom with version 0.15-SNAPSHOT.

@rhuss
Copy link
Collaborator

rhuss commented Aug 8, 2016

Thanks a lot, I will cut a release soon with this changes.

w.r.t to autentication, we wil continue on #534 . However, normally you should be abel to use at least means for authentication as described in https://dmp.fabric8.io/#authentication

rhuss added a commit that referenced this pull request Aug 9, 2016
rhuss added a commit that referenced this pull request Aug 9, 2016
@rhuss
Copy link
Collaborator

rhuss commented Aug 9, 2016

@jan-zajic I merged this PR to branch integration, and refactored it a bit. I also tried to test it on Windows 10, but I fail when I run the the sample data-jolokia-demo: Calling mvn docker:build and mvn docker:start separately works, except that docker:start hangs in some wait condition.

However when I run mvn clean install where both targets are called after each other, I get an '231 PIPE_BUSY_ERROR' for docker:start, after docker:build has finished. So I added some close() calls on the HttpClient, but that didn't help.

@jan-zajic could you (or some of your coworkers) try this, too, by checking out branch integration and run the sample on Docker for Windows ? I'm still not sure what this could be but must be releated with not closing resources properly.

@rhuss
Copy link
Collaborator

rhuss commented Aug 9, 2016

Another good test is https://github.com/rhuss/docker-maven-sample (where the pom.xml needs to be updated to the proper d-m-p snapshot version).

@rhuss
Copy link
Collaborator

rhuss commented Aug 10, 2016

I found out, that when waiting on a condition in the logoutput as it happens for the docker-maven-sample, then the main thread block on channel.close()

All in all I have the impression, its not very stable and probably cant released in this state. Maybe one can have a look how other Java Docker access libraries like https://github.com/docker-java/docker-java support Docker for Windows ? I really would love to include this in d-m-p.

Said that, I'm soon off for holidays the next three weeks, and wont be able to continue here in the meantime.

@arielcarrera
Copy link

arielcarrera commented Aug 11, 2016

Hi Roland, I suspect that this problem occurs only with authentication
"wincred" ...I'm testing the 'linux style' authentication setting in the
config.json and seems to work better (although it is too early to say)

{
  "auths": {
    "my.server": {
      "auth": "dXN1YXJpbzpwYXNzd29yZA=="
    }
  }
}

I know it can be less secure but I am trying with this configuration, maybe
it work.

@arielcarrera
Copy link

It could be a temporary workaround.

2016-08-11 12:19 GMT-03:00 Ariel Carrera carreraariel@gmail.com:

Hi Roland, I suspect that this problem occurs only with authentication
"wincred" ...I'm testing the 'linux style' authentication setting in the
config.json and seems to work better (although it is too early to say)

{
"auths": {
"my.server": {
"auth": "dXN1YXJpbzpwYXNzd29yZA=="
}
}
}

I know it can be less secure but I am trying with this configuration,
maybe it work.

2016-08-10 9:19 GMT-03:00 Roland Huß notifications@github.com:

I found out, that when waiting on a condition in the logoutput as it
happens for the docker-maven-sample, then the main thread block on
channel.close()

All in all I have the impression, its not very stable and probably cant
released in this state. Maybe one can have a look how other Java Docker
access libraries like https://github.com/docker-java/docker-java support
Docker for Windows ? I really would love to include this in d-m-p.

Said that, I'm soon off for holidays the next three weeks, and wont be
able to continue here in the meantime.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#532 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFRJnv-pVcKMZlEH4ilmvK3LmeRfvyrXks5qecHTgaJpZM4JaiVT
.

Tatú

Tatú

@rhuss
Copy link
Collaborator

rhuss commented Aug 11, 2016

@arielcarrera I dont think its related to authentication as I can successfully build images (mvn docker:build) and run images (mvn docker:start) but not when I do them both in one run (mvn docker:build docker:start).

It pretty sure a threading and locking thing.

@arielcarrera
Copy link

Ok Roland, don't worry I am working with version 0.15.2... after install
docker for windows (Windows 10) I experienced certain problems with the
plugin. A normal build process, happened to take from 3 minutes to 59
minutes (waiting after the end of the build process). I thought you might
be experiencing the same problem.
But I don't know why now after install some windows updates and change my
credentials... it works again...

2016-08-11 13:24 GMT-03:00 Roland Huß notifications@github.com:

@arielcarrera https://github.com/arielcarrera I dont think its related
to authentication as I can successfully build images (mvn docker:build)
and run images (mvn docker:start) but not when I do them both in one run (mvn
docker:build docker:start).

It pretty sure a threading and locking thing.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#532 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFRJnoLH0gQP_wfJ4q5JKTJlVLITKxC-ks5qe0yggaJpZM4JaiVT
.

Tatú

@rhuss rhuss merged commit 8112cdf into fabric8io:master Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants