diff --git a/Dockerfile b/Dockerfile index 72bc5c5..81d93ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN yum -y install \ # Docker daemon won't start without `iptables` installed iptables-services \ # Used for a variety of simple tests for port forwarding/publishing - nmap-ncat \ + nmap-ncat net-tools \ # Allow `dock-user` to escalate privileges if necessary sudo \ # Allow us to run using OverlayFS file system diff --git a/bin/dock b/bin/dock index dad3b23..48f3be8 100755 --- a/bin/dock +++ b/bin/dock @@ -693,7 +693,12 @@ destroy_container() { } port_taken_on_localhost() { - echo | nc -w 1 localhost $1 >/dev/null 2>&1 + if osx; then + # show -a(ll sockets) and -n(umeric addresses) + echo | netstat -a -n 2>/dev/null | grep $1 >/dev/null 2>&1 + else + echo | netstat --numeric --listening 2>/dev/null | grep $1 >/dev/null 2>&1 + fi } process_exposed_ports() {