Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 -p elasticsearch:0.90.5

where 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 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 brd 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 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
share|improve this question

Docker might support networking in the future. But for now you can you Pipework to manage Docker network like this (Host only).

sudo pipework br1 $(docker run -d -i -t elasticsearch:0.90.5)
sudo ip addr add dev br1

But if you want it to be public IP address x.x.x.x (ubiquitous):

pipework eth0 $(docker run -d -i -t elasticsearch:0.90.5) x.x.x.x
share|improve this answer
Docker has had network support since March – Kevin Dec 10 '13 at 22:00

I thought that running it like you did at first docker run -d -i -t -p 9200:9200 -p 9300:9300 elasticsearch:0.90.5 should work. Maybe you also have a firewall interfering?

Can you try to run a normal server (ideally elasticsearch without docker, because the elasticsearch config could be a problem too) on port 9200 or whatever first and make sure you can connect to that? And once thats working I think the original command should work.

Maybe try sudo ufw allow 9200 or something?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.