First: could someone with 300 rep make a tag for "docker" please? TYVM
I'm running a docker container for elasticsearch with the following command:
docker run -d -i -t -p 9200:9200 -p 9300:9300 elasticsearch:0.90.5
Which launches correctly and when I curl localhost:9200 I get the elasticsearch json hello world message.
What I can't figure out is how to get the ports to be exposed outside the box. What I am trying to do is:
docker run -d -i -t -p 123.123.123.123:9200:9200 -p 123.123.123.123:9300:9300 elasticsearch:0.90.5
where 123.123.123.123 is the eth0 IP address. That does not seem to work.
And now my question: How do I properly run this container and expose these ports to the outside world?
Here is my "ip addr" from the box which is a headless vmware running ubuntu 12.04.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:52:56:93:78:f6 brd ff:ff:ff:ff:ff:ff
inet 162.248.XXX.XXX/24 brd 162.248.XXX.255 scope global eth0
inet6 XXX::250:ab00:fe89:78f6/64 scope link
valid_lft forever preferred_lft forever
3: lxcbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 72:44:60:e8:46:2a brd ff:ff:ff:ff:ff:ff
inet 10.0.3.1/24 brd 10.0.3.255 scope global lxcbr0
inet6 XXX::7080:60ff:fee8:462a/64 scope link
valid_lft forever preferred_lft forever
4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether ba:d6:67:1a:13:bc brd ff:ff:ff:ff:ff:ff
inet 172.17.42.1/16 scope global docker0
inet6 XXX::549c:ebff:fe7d:a22/64 scope link
valid_lft forever preferred_lft forever
210: vethgVxkby: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master docker0 state UP qlen 1000
link/ether ba:d6:67:1a:13:bc brd ff:ff:ff:ff:ff:ff
inet6 XXX::b8d6:67ff:fe1a:13bc/64 scope link
valid_lft forever preferred_lft forever
Best Answer
Docker might support networking in the future. But for now you can you Pipework to manage Docker network like this (Host only).
But if you want it to be public IP address x.x.x.x (ubiquitous):