title: cannot connect to cassandra docker with cqlsh
body: <p>I'm run Cassandra docker container:</p>
  
  <pre><code>docker pull cassandra
  run --name cassandra -p 9042:9042 -p 9160:9160   -d cassandra  
  </code></pre>
  
  <p>The netstat -tpln is:</p>
  
  <pre><code>Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  
  LISTEN    -  tcp6       0      0 [::]:9160               [::]:*
  LISTEN    -  tcp6       0      0 [::]:9042               [::]:*
  </code></pre>
  
  <p>Connection to C* from local cqlsh is Ok:</p>
  
  <pre><code>docker exec -it cassandra /bin/bash
  #cqlsh
  Connected to Test Cluster at 127.0.0.1:9042. 
  [cqlsh 5.0.1 | Cassandra 3.1.1 | CQL spec 3.3.1 | Native protocol v4] 
  Use HELP for help.
  cqlsh&gt; show host     
  Connected to Test Cluster at 127.0.0.1:9042.  
  </code></pre>
  
  <p>I install the local cqlsh:</p>
  
  <pre><code>$cqlsh --version
  cqlsh 4.1.1
  </code></pre>
  
  <p>but, I don't connecton with docker container from localhost:</p>
  
  <pre><code>$sqlsh
  Traceback (most recent call last):
    File "/usr/sbin/cqlsh", line 2067, in &lt;module&gt;
      main(*read_options(sys.argv[1:], os.environ))
    . . .
    File "/home/akalend/src/cqlsh_standalone/lib/thrift-python-internal-only-0.9.1.zip/thrift/transport/TSocket.py", line 103, in read
  socket.error: [Errno 104] Connection reset by peer
  </code></pre>
  
  <p>So, I don't connection from localhost php-driver.</p>
  
  <p><strong>How I can connection cassandra docker with my php script &amp; cqlsh?</strong></p>
  
  <p><em>Why docker mapping port to tcp6, do not tcp4 ?</em>   <strong>resolve</strong></p>
  
  <p><strong>Why the local cqlsh (version 4.1) connect by 9160 port, but docker container cqlsh(version 5.0.1) connect by 9042 port?</strong> </p>
  
  <hr>
  
  <p><strong>added info</strong></p>
  
  <p>If run conteiner as:</p>
  
  <pre><code>run --name cassandra -p 127.0.0.1:9042:9042 -p 127.0.0.1:9160:9160   -d cassandra 
  </code></pre>
  
  <p>I have listen ip4 ports:</p>
  
  <pre><code>Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address Foreign Address  State       PID/Program name
  tcp        0      0 127.0.0.1:9160 0.0.0.0:*       LISTEN      2454/docker-proxy
  tcp        0      0 127.0.0.1:9042 0.0.0.0:*       LISTEN      2462/docker-proxy
  </code></pre>
  
  <p>but I havn't connection with cqlsh &amp; php</p>
  
  <pre><code>socket.error: [Errno 104] Connection reset by peer
  
  PHP Fatal error:  Uncaught exception 'Cassandra\Exception\RuntimeException' with message 'No hosts available for the control connection' in /home/akalend/projects/test/cassa/test.php:7
  Stack trace:
  #0 /home/akalend/projects/test/cassa/test.php(7): Cassandra\DefaultCluster-&gt;connect('system')
  #1 {main} thrown in /home/akalend/projects/test/cassa/test.php on line 7
  </code></pre>