-
Notifications
You must be signed in to change notification settings - Fork 1k
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
docker for mac compatibility #537
Comments
2.2.3 is latest |
Do you mean docker 4 mac beta? |
|
I would look at libraries when i get access to beta :) |
Hello, I have no idea how to expose a rest API from the Unix socket or using docker 4mac... I'll provide further details on the link error tomorrow |
@jeantil I assume you configured the docker client to connect via unix socket at |
@KostyaSha docker-java transitively depends on an older version of junixsocket. An updated release of https://bintray.com/gesellix/docker-utils/unix-socket-factory/2016-04-06T22-21-19/view should show up in Maven Central, soon. Since you're not actually using
|
Project uses https://github.com/docker-java/docker-java/blob/master/pom.xml#L102-L105 |
@KostyaSha next time ;-) but as suggested I would replace the current dependency on unix-socket-factory with the direct dependency on junixsocket. |
as incentive to update: the https://github.com/gesellix/docker-client/ works for me on Docker for Mac using junixsocket 2.0.4. |
@gesellix am i right understand that it's groovy client library? 0_o |
if you mean docker-client: yes |
Please note that this would affect the netty impl also. |
Related: netty/netty#2448 |
When going through org.testcontainers I have not configured (or tried to configure) anything and I am not sure I could configure. org.testcontainers first tries to find docker-machine, start it, get the ip for the docker host and connect to it using https, if that fails it automatically falls back to unix socket which yields the UnsatisfiedLinkError I mentionned in my initial post. When building docker-java master from source and running the integration tests I have tried the following in this order:
As mentionned in my initial report, I tried manually adding the library to my app classpath (I find it weird that the lib is not embedded in the jar but that might be an artifact of the shading from org.testcontainers).
honestly I gave up at that point ... :) But reading through the detailed logs, it looks like we get an internal server error response from the docker host so maybe I should log this with the docker team. I just want to make sure it's not an API version mismatch (this is using docker-client 2.2.0 and docker4mac is using the very latest docker maybe the API changed in an incompatible way I would love to get confirmation though ... ) If anyone has testcases to run to check out connectivity I would be glad to help and report results here. (I can't give access to the beta, but I am pretty sure if you ask the docker team saying you are a dev of a docker tool you will get access pretty fast)
I have no idea how to make docker4mac expose a REST API, not sure it is even possible |
dylib is system library, i guess that you should place it to LD paths https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/UsingDynamicLibraries.html |
@KostyaSha I know that dylib is a system library, (at least a native library for the jvm) :) However, as I said, the version of junixsocket used by docker-java 2.2.0 which is embedded in org.testcontainers, _does NOT_ load the native library from the usual
Notice the line It then proceeds to copy the file to a temp directory and tells the jvm to load the file from that location with an absolute path (which bypasses the lookup in
The last line will actually tell the JVM to link with the native library. @gesellix mentioned earlier that docker-java should not depend on unix-socket-factory anymore but instead add a direct dependency on junixsocket 2.0.4. I am not sure what the link to netty is though. cheers |
@jeantil please note the slight difference between the unix addresses: we have I'm not sure about the |
@gesellix thanks for that pointer this might explain why my tests failed
I haven't had the time to dig deeper into this, I just wanted to make a sanity check on whether my test suite would work without docker machine. the test suite uses testcontainers to start a container. I only pasted the log of the container start failing, there are many others before. When my project stops being such a mess, I'll look into this deeper (unless someone beats me to it). |
@jeantil ah, yes. It's not very obvious, but the docs say that
|
So, I'd suggest to give |
another low level test to verify basic correctness of your Docker for Mac env:
|
I am not sure I understand what you mean and
So i guess this is a linux specific thing .. The build is running as I write with DOCKER_HOST set manually but docker4mac doesn't seem to export it automatically to the shells (would be nice if the client could check both unix sockets) the docker4mac environment works fine, I can start and stop containers with the cli without any problem and the low level test works too :
|
Same error in the integration tests. docker-java doesn't seem to care about DOCKER_HOST :) |
Regarding DOCKER_OPTS, I think I see what you mean, this would alter the way the docker daemon works. I don't think it is desirable in this case. As a user I would expect the client to try the various default urls until it finds one which works.
section. It doesn't say how to configure the famous url (which in my case would be Thanks for your pointers though :) |
@jeantil yeah, I also don't know how to apply the configuration to docker-java, so I guess one of the maintainers can help. About the clients checking different well known defaults I wouldn't be so content, because the official/native docker client also doesn't behave that way. I'll give the Docker for Mac maintainers feedback about that, though. |
Maybe you are right and this should be the responsibility of the tools using the client to specify how they want to handle fallback. That's the case at the moment ( testcontainers is the one implementing the fallback strategies using the various strategies proposed by docker-java ) |
request for a consistent default connection url: https://forums.docker.com/t/can-we-have-unique-default-connection-urls-across-platforms/8633 |
you can safely forget the stuff with |
Ok I just added these as dependencies to the docker-maven-plugin:
Built the 2.0.4 library and installed the jni libraries sudo cp ./junixsocket-native/target/nar/junixsocket-native-2.0.4-x86_64-MacOSX-gpp-jni/lib/x86_64-MacOSX-gpp/jni/libjunixsocket-native-2.0.4.* /Library/Java/Extensions/ and all was good. So simply updating the dependencies moves this forward a fair way for me. |
@andyp1per you might consider to enforce it via dependency management - but as @marcuslinke mentioned this won't be the fix for the Netty based implementation. @normanmaurer would it be an option to start with a blocking implementation in Netty and "fix" that as soon as the other projects have tackled their issues Netty depends on? I'm aware that such a hack cannot be considered as a solution, but I would also hope that from the user's perspective the interface won't change when switching from the hack to a better implementation. Maybe we can find a way to make it just work without the risk to break a consumer's code too much. |
@gesellix let me see what I can do... Super busy atm tho :( Can you link me to the code in docker-java that uses the netty epoll stuff for domain sockets ? |
@normanmaurer Since I'm not involved in the docker-java development, I'd ask @KostyaSha or @marcuslinke for that code pointer :-) |
Further to my previous update I'm happy to report that updating the dependencies is the only thing that needs to be done to make this work on OSX. Can I request that you release a patch release with this change since it fixes the broken current state of affairs. |
@andyp1per for netty? |
No, using the existing mechanisms. If you remember the issue that started this was java.lang.UnsatisfiedLinkError - turns out this is simply because the code is transitively referencing an old version of junixsocket. If you fix this then life is good :) |
What is the |
Can you point me at the PR? |
Ok I created a PR that works for me: |
Thanks On 23 Aug 2016 2:30 p.m., "Andy Piper" notifications@github.com wrote:
|
@KostyaSha, @normanmaurer I've created an experimental branch that uses https://github.com/jnr/jnr-unixsocket for netty implementation. Basically it seems to run on linux but should support macos also. So any interested people might try out https://github.com/docker-java/docker-java/tree/unixsocket-experiment now. If it works with macos in general then maybe we can fix the issues mentioned by @normanmaurer here netty/netty#2448 |
@marcuslinke how it can work on macos if there is no kqueue support anywhere? |
@KostyaSha https://github.com/jnr/jnr-unixsocket supports macos via kqueue. I'm working on implementation of an As I mentioned before it works BASICALLY on linux but most tests still failing because the implementation is (still) buggy. |
@marcuslinke rebase it to get matrix travis builds against different versions. |
for reference: #692 |
any update on this? I |
@andyp1per : you wrote: Ok I just added these as dependencies to the docker-maven-plugin:
Built the 2.0.4 library and installed the jni libraries sudo cp ./junixsocket-native/target/nar/junixsocket-native-2.0.4-x86_64-MacOSX-gpp-jni/lib/x86_64-MacOSX-gpp/jni/libjunixsocket-native-2.0.4.* /Library/Java/Extensions/ and all was good. So simply updating the dependencies moves this forward a fair way for me. can you please add some more info about how you built the 2.0.4 library? |
A colleague reported that they didn't need to build the library, so I think just updating the dependencies works. |
I'm trying to run my tests in OSX (built against testcontainers:1.1.10, based on docker-java:3.0.7). 2> Exception in thread "Thread-2" java.lang.ExceptionInInitializerError
2> at org.newsclub.net.unix.AFUNIXSocket.<init>(AFUNIXSocket.java:36)
2> at org.newsclub.net.unix.AFUNIXSocket.newInstance(AFUNIXSocket.java:54)
2> at org.rnorth.tcpunixsocketproxy.TcpToUnixSocketProxy.lambda$start$0(TcpToUnixSocketProxy.java:86)
2> at java.lang.Thread.run(Thread.java:745)
2> Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
2> at org.newsclub.net.unix.NativeUnixSocket.<clinit>(NativeUnixSocket.java:42)
2> ... 4 more
2> Caused by: java.lang.reflect.InvocationTargetException
2> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2> at java.lang.reflect.Method.invoke(Method.java:498)
2> at org.newsclub.net.unix.NativeUnixSocket.<clinit>(NativeUnixSocket.java:35)
2> ... 4 more
2> Caused by: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: ./temp/libjunixsocket-native-2.0.49049338348292982436.dylib
2> at java.lang.Runtime.load0(Runtime.java:806)
2> at java.lang.System.load(System.java:1086)
2> at org.newsclub.net.unix.NarSystem.loadLibrary(NarSystem.java:39)
2> ... 9 more NB: This happens even if I already:
Did I miss some steps? |
Hi, i have similar issue on windows 10. |
With the latest version of Docker for Mac (17.04) and IntelliJ IDEA (2017.1), socket communication now works. I just had to edit the configuration for my local Docker connection in IDEA and change the API URL back to unix:///var/run/docker.sock . |
Hi @deinspanjer I encountered exception Only supported on Linux; Could you give some suggestion? |
@xuchenCN What version of Docker for Mac and IntelliJ IDEA are you using? Is IDEA community or Ultimate? I forgot to mention in my comment above, but I am using the Ultimate version. Not sure if that matters. I am also running OSX 10.11.6. Did you change the local Docker connection API URL? |
junixsocket 2.2 now supports Windows 10 (as well as macOS, and Linux on Intel and ARM), please give it a try! |
Hello,
I am beta testing docker 4 mac and when I disable docker-machine my test suite fails with
The latest version of test containers (1.0.3 at the time of this writing) uses docker-java 2.2.0 (https://github.com/testcontainers/testcontainers-java/blob/2e227e29eded31c0b2d45a5351cc108994327394/core/pom.xml#L20) so I assume it is safe to say that docker-java 2.2.0 is not compatible with docker 4 mac. (I tried adding the dylib to my classpath and got further errors, also the compiled dylib seems hard to find and it feels very cumbersome to have to add it to the classpath manually).
I want to create a bug report to org.testcontainers asking them to upgrade docker-java to a docker4mac compatible version so I checked out the repository and tried to build master using only docker4mac.
I first got an error in com.github.dockerjava.client.DockerClientTest which seems to be the integration test. The error was that $HOME/.docker/certs did not exist. After creating that directory, I get the following output :
And I am unsure what to conclude, the test failure seems to suggest that the lastest master is not docker4mac compatible either but a single failed test seems surprising ...
Can you help me troubleshoot or maybe you already know if master is compatible with docker4mac ...
Thanks for your help
jean
The text was updated successfully, but these errors were encountered: