title: How to get my hdfs docker client running?
body: <p>I'm starting an <a href="https://github.com/sequenceiq/hadoop-docker" rel="nofollow noreferrer">hdfs server</a> with:</p>
  
  <pre><code>docker run -d sequenceiq/hadoop-docker:2.6.0
  </code></pre>
  
  <p>I'm observing the running docker processes with</p>
  
  <pre><code>docker ps
  </code></pre>
  
  <p>Which gets the following result:</p>
  
  <pre><code>6bfa4f2fd3b5        sequenceiq/hadoop-docker:2.6.0   "/etc/bootstrap.sh -d"   
  31 minutes ago      Up 31 minutes       22/tcp, 8030-8033/tcp, 8040/tcp, 
  8042/tcp, 8088/tcp, 49707/tcp, 50010/tcp, 50020/tcp, 50070/tcp, 50075/tcp, 
  50090/tcp   kind_hawking
  </code></pre>
  
  <p>I'm trying to <a href="https://github.com/davvdg/hdfs-client" rel="nofollow noreferrer">connect via <code>hdfs</code></a> to my docker container with:</p>
  
  <pre><code>sudo docker run -ti davvdg/hdfs-client hadoop fs -fs hdfs://localhost:50075 -ls /
  </code></pre>
  
  <p>This gives the following resut:</p>
  
  <pre><code>ls: Call From a48f81b8e1bb/172.17.0.3 to localhost:50075 failed on 
  connection exception: java.net.ConnectException: Connection refused; For 
  more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
  </code></pre>
  
  <p>My question is: <strong>How to get my hdfs docker client running?</strong></p>
  
  <hr>
  
  <p>Edit:
  Thanks to some helpful feedback from @shizhz I'm updating the question. </p>
  
  <p>Here is my <code>Dockerfile</code></p>
  
  <pre><code>FROM sequenceiq/hadoop-docker:2.6.0
  
  CMD ["/etc/bootstrap.sh", "-d"]
  
  # Hdfs ports
  EXPOSE 50010 50020 50070 50075 50090 8020 9000
  # Mapred ports
  EXPOSE 10020 19888
  #Yarn ports
  EXPOSE 8030 8031 8032 8033 8040 8042 8088
  #Other ports
  EXPOSE 49707 2122
  
  EXPOSE 9000
  
  EXPOSE 2022
  </code></pre>
  
  <p>Here is how I'm building the image:</p>
  
  <pre><code> sudo docker build -t my-hdfs .
  </code></pre>
  
  <p>Here is how I'm running the image:</p>
  
  <pre><code>sudo docker run -d -p my-hdfs 
  </code></pre>
  
  <p>Here is how I'm checking the processes:</p>
  
  <pre><code>sudo docker ps
  </code></pre>
  
  <p>with a result like:</p>
  
  <pre><code>d9c9855cfaf0        my-hdfs             "/etc/bootstrap.sh -d"   2 minutes ago       
  Up 2 minutes        0.0.0.0:32801-&gt;22/tcp, 0.0.0.0:32800-&gt;2022/tcp, 
  0.0.0.0:32799-&gt;2122/tcp, 0.0.0.0:32798-&gt;8020/tcp, 0.0.0.0:32797-&gt;8030/tcp, 
  0.0.0.0:32796-&gt;8031/tcp, 0.0.0.0:32795-&gt;8032/tcp, 0.0.0.0:32794-&gt;8033/tcp, 
  0.0.0.0:32793-&gt;8040/tcp, 0.0.0.0:32792-&gt;8042/tcp, 0.0.0.0:32791-&gt;8088/tcp, 
  0.0.0.0:32790-&gt;9000/tcp, 0.0.0.0:32789-&gt;10020/tcp, 0.0.0.0:32788-&gt;19888/tcp, 
  0.0.0.0:32787-&gt;49707/tcp, 0.0.0.0:32786-&gt;50010/tcp, 0.0.0.0:32785-&gt;50020/tcp, 
  0.0.0.0:32784-&gt;50070/tcp, 0.0.0.0:32783-&gt;50075/tcp, 0.0.0.0:32782-&gt;50090/tcp   
  agitated_curran
  </code></pre>
  
  <p>Here is how I'm getting the IP address:</p>
  
  <pre><code>docker inspect --format '{{ .NetworkSettings.IPAddress }}' d9c9855cfaf0
  </code></pre>
  
  <p>with a result like:</p>
  
  <pre><code>172.17.0.3
  </code></pre>
  
  <p>Here is how I'm running the test:</p>
  
  <pre><code>sudo docker run --rm sequenceiq/hadoop-docker:2.6.0 /usr/local/hadoop-2.6.0/bin/hadoop fs -fs hdfs://192.168.0.3:9000 -ls /
  </code></pre>
  
  <p>With a result like:</p>
  
  <pre><code>17/04/08 19:51:54 INFO ipc.Client: Retrying connect to server: 
  192.168.0.3/192.168.0.3:9000. Already tried 0 time(s); maxRetries=45
  ls: Call From fafcd377f4a0/172.17.0.2 to 192.168.0.3:9000 failed on connection 
  exception: java.net.ConnectException: Connection refused; For more details 
  see:  http://wiki.apache.org/hadoop/ConnectionRefused
  </code></pre>
  
  <p>My question is: <strong>How to get my hdfs docker client running?</strong></p>