palantir/docker-compose-rule

Improve Check for localunixsocket on Mac

nathanloyer opened this issue · 0 comments

I've been using docker for a few years and had added 127.0.0.1 localunixsocket (with a tab) a long time ago, and have been getting the warnings from docker regardless. I only just now looked into it and found that the check to make sure localunixsocket points to 127.0.0.1 is done by checking for an exact string. A better check would be to try to resolve localunixsocket and see if you get 127.0.0.1 for the IP. Another option that would catch everything would be to use regex with something like 127.0.0.1\\s+localunixsocket.

private static final String REDIRECT_LINE = "127.0.0.1 localunixsocket\n";

This isn't very important, just something that bugged me when I figured out the cause.