1
votes

I could be missing something ridiculous, but every docker container I have tried to expose to my host machine (Mac) doesn't seem to work. I can tell that the containers are running and appear to have properly been exposed to the port I chose. Am I missing something obvious? Any help would be greatly appreciated.

I pulled down latest ElasticSearch image: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

Run Docker: docker run -d -p 9200:9200 docker.elastic.co/elasticsearch/elasticsearch:5.4.0

Request to see running images: docker ps

View running image: 5e8ae3b13f7c docker.elastic.co/elasticsearch/elasticsearch:5.4.0 "/bin/bash bin/es-..." 4 seconds ago Up 4 seconds 0.0.0.0:9200->9200/tcp, 9300/tcp eloquent_almeida

Run lsof to see if anything exposed on port 9200 lsof -i tcp:9200

Nothing returned

Mac OS: 10.12.4

Docker Updated Version:

docker version
Client:
 Version:      17.04.0-ce
 API version:  1.27 (downgraded from 1.28)
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Wed Apr  5 23:33:17 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Mon Mar 27 16:58:30 2017
 OS/Arch:      linux/amd64
 Experimental: false

Downloaded nmap and ran against 9200 localhost. Also made sure 9200 is open now in /etc/pf.conf.

Nmap scan report for localhost (127.0.0.1)
Host is up (0.00016s latency).
Other addresses for localhost (not scanned): ::1
PORT     STATE  SERVICE
9200/tcp closed wap-wsp

Also tried using docker-machine on mac's IP:

docker-machine ip default
192.168.99.100

Tried 192.168.99.100:9200 and still no luck
1
What shows netstat -atp tcp | grep 9200?Bor Laze
Hi @BorLaze nothing comes up when I run that command, just like the lsof check (also tried localhost:9200, 127.0.0.1:9200, which of course wont' return if nothing is on that port). Thanks for the response.scarpacci
Are you using docker-for-mac? Or the older docker machine?Robert
Hi @Robert I believe i am using docker-for-mac (docker.com/products/docker-toolbox)scarpacci
Output from my versions: Client: Version: 1.13.1 API version: 1.26 Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 08:47:51 2017 OS/Arch: darwin/amd64 Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 08:47:51 2017 OS/Arch: linux/amd64 Experimental: falsescarpacci

1 Answers

2
votes

You know, it looks like something is wrong with downloaded image or docker installation. I repeated your steps - all is Ok:

[06:40 PM] borlaze@mac: /tmp $ docker run -d -p 9200:9200 docker.elastic.co/elasticsearch/elasticsearch:5.4.0

[06:41 PM] borlaze@mac: /tmp $ docker ps
CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                              NAMES
fd05a1fe9b5a        docker.elastic.co/elasticsearch/elasticsearch:5.4.0   "/bin/bash bin/es-..."   9 seconds ago       Up 7 seconds        0.0.0.0:9200->9200/tcp, 9300/tcp   practical_bell

[06:41 PM] borlaze@mac: /tmp $ lsof -i tcp:9200
COMMAND     PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
com.docke 32108 borlaze   21u  IPv4 0x601aa3189a6fc3e3      0t0  TCP *:wap-wsp (LISTEN)
com.docke 32108 borlaze   22u  IPv6 0x601aa318a167e6cb      0t0  TCP localhost:wap-wsp (LISTEN)

Checked on OS 10.12.4, docker

[06:45 PM] borlaze@mac: /tmp $ docker version
Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Tue Mar 28 00:40:02 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:00:50 2017
 OS/Arch:      linux/amd64
 Experimental: true

Try to remove image and repeat.