add a fallback for docker detection on Mac (#6356)

Signed-off-by: garyschulte <garyschulte@gmail.com>
pull/6390/head
garyschulte 10 months ago committed by GitHub
parent f721c1c2c2
commit 945a44c598
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      nat/src/main/java/org/hyperledger/besu/nat/docker/DockerDetector.java

@ -33,6 +33,8 @@ public class DockerDetector implements NatMethodDetector {
return stream
.filter(line -> line.contains("/docker"))
.findFirst()
// fallback to looking for /.dockerenv in case we are running on Docker for Mac
.or(() -> Optional.ofNullable(Files.exists(Paths.get("/.dockerenv")) ? "docker" : null))
.map(__ -> NatMethod.DOCKER);
} catch (IOException e) {
return Optional.empty();

Loading…
Cancel
Save