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

Fix alpine socket bug #290

Closed
wants to merge 4 commits into from

Conversation

kiview
Copy link
Member

@kiview kiview commented Feb 11, 2017

In case of an UnsatisfiedLinkError (which will happen if needed system libraries are missing) when trying to access Docker via Unix socket, a proxied Unix socket is used as a fallback on Linux instead. In addition, the check for determining the concrete HostPortWaitStrategy behavior now depends on mac as an OS.

However please note, that the existing mac workaround might not work if using images that don't contain bash or sh.

In case of an UnsatisfiedLinkError (which will happen if needed system libraries are missing) when trying to access Docker via Unix socket, a proxied Unix socket is used as a fallback on Linux instead.
The deciding factor of the HostPortWaitStrategy is the OS name and not the used DockerClientProviderStrategy.
However please note, that the existing mac workaround might not work if using images that don't contain bash or sh.
@bsideup bsideup added this to the 1.1.9 milestone Feb 11, 2017
@@ -33,7 +33,7 @@ protected void waitUntilReady() {
Callable<Boolean> checkStrategy;

// Special case for Docker for Mac, see #160
if (DockerClientFactory.instance().isUsing(ProxiedUnixSocketClientProviderStrategy.class)) {
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
Copy link
Member

Choose a reason for hiding this comment

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

this might break docker-machine + Mac. IMO "and" logic is more appropriate here

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think that this will break mac compatibility (the usage of ProxiedUnixSocketClientProviderStrategy is determined by the same check), but since there are no automated mac tests, playing it safe might be more sensible here?

Copy link
Member

Choose a reason for hiding this comment

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

only Docker for Mac's port checking is broken, this is why we check here. Docker Machine works fine

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, I'll change it accordingly then.

.travis.yml Outdated
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)":"$(pwd)" \
-w "$(pwd)" \
joepjoosten/openjdk-alpine-bash \
Copy link
Member

Choose a reason for hiding this comment

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

":latest" + 3rd party image. @rnorth maybe it's time to create testcontainers org on Docker Hub?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could remove this test as well, but I thought this might be a helpful regression test for alpine compatibility. The image itself is very simple however, so we could easily implement our own version.

Copy link
Member

Choose a reason for hiding this comment

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

Please could you pin to a specific tag at least for now?

I absolutely would like to set up our own images for everything - maybe a separate conversation right now though. IIRC someone is squatting on the name testcontainers (for more than a year), which sucks :(

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly this image does not provide any tags. If you like I can setup my own version of this image and freeze a version tag.

if (!System.getProperty("os.name").toLowerCase().contains("mac")) {
throw new InvalidConfigurationException("this strategy is only applicable to OS X");
String osName = System.getProperty("os.name").toLowerCase();
if (!osName.contains("mac") && !osName.contains("linux")) {
Copy link
Member

Choose a reason for hiding this comment

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

do we even have to check?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could switch logic and check for Windows.

@rnorth
Copy link
Member

rnorth commented Feb 11, 2017

This is looking great, thanks. Let's aim to merge tomorrow, and I'll release tomorrow night.

@rnorth
Copy link
Member

rnorth commented Feb 12, 2017

Just testing locally then will merge

@rnorth
Copy link
Member

rnorth commented Feb 12, 2017

Merged manually- thanks!

@rnorth rnorth closed this Feb 12, 2017
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants