title: Make docker use IPv4 for port binding
body: <p>I have docker host and inside I have one container.</p>
  
  <p>The docker host is binding the port on IPv6 interface only, not on IPv4.</p>
  
  <p>This is the output</p>
  
  <pre><code>tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
  tcp        0      0 0.0.0.0:55082           0.0.0.0:*               LISTEN      -
  tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -
  tcp6       0      0 :::80                   :::*                    LISTEN      -
  tcp6       0      0 :::22                   :::*                    LISTEN      -
  tcp6       0      0 :::40280                :::*                    LISTEN      -
  tcp6       0      0 :::5432                 :::*                    LISTEN      -
  tcp6       0      0 :::40122                :::*                    LISTEN      -
  tcp6       0      0 :::36378                :::*                    LISTEN      -
  tcp6       0      0 :::40543                :::*                    LISTEN      -
  tcp6       0      0 :::111                  :::*                    LISTEN      -
  </code></pre>
  
  <p>Now I have 40122 port on host to link with port 22 on container.</p>
  
  <p>I want to SSH into that container but I am not able to as its only bound to IPv6</p>
  
  <p>This is my docker version  <code>Docker version 1.5.0, build a8a31ef</code></p>
  
  <p><code>docker ps</code></p>
  
  <pre><code>201bde6c839a        myapp:latest   "supervisord -n"    3 weeks ago         Up 2 hours          0.0.0.0:40122-&gt;22/tcp, 0.0.0.0:40280-&gt;80/tcp, 0.0.0.0:40543-&gt;443/tcp   myapp
  </code></pre>
  
  <p>I ran using   <code>docker run -d -P -p 40122:22</code></p>
  
  <pre><code>netstat -tlna
  
  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
  tcp        0      0 127.0.0.1:3031          0.0.0.0:*               LISTEN
  tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN
  tcp6       0      0 :::22                   :::*                    LISTEN
  tcp6       0      0 :::6379                 :::*                    LISTEN
  </code></pre>
  
  <p>ps aux</p>
  
  <pre><code>root         1  0.0  0.8  52440 16668 ?        Ss   00:53   0:03 /usr/bin/python /usr/bin/supervisord -n
  root        49  0.0  0.1  17980  3048 ?        S    01:32   0:00 bash
  root        64  0.0  0.1  46632  2712 ?        S    01:32   0:00 su -l vagrant
  vagrant     65  0.0  0.1  21308  3760 ?        S    01:32   0:00 -su
  root       288  0.0  0.1  17980  3088 ?        S    02:01   0:00 bash
  root       304  0.0  0.1  46632  2720 ?        S    02:01   0:00 su -l vagrant
  vagrant    305  0.0  0.1  21304  3804 ?        S    02:01   0:00 -su
  vagrant    308  0.0  3.7 429616 75840 ?        Sl+  02:01   0:05 python ./manage.py shell_plus
  root       654  0.0  0.4  47596  9848 ?        S    03:12   0:01 /usr/local/bin/uwsgi --die-on-term --ini /var/www/conf/uwsgi.ini
  root       655  0.0  0.3  90280  7732 ?        S    03:12   0:00 nginx: master process /usr/sbin/nginx
  www-data   656  0.0  0.1  90600  3624 ?        S    03:12   0:00 nginx: worker process
  www-data   657  0.0  0.1  90600  3624 ?        S    03:12   0:00 nginx: worker process
  www-data   658  0.0  0.1  90600  3624 ?        S    03:12   0:00 nginx: worker process
  www-data   659  0.0  0.2  90940  4500 ?        S    03:12   0:00 nginx: worker process
  root       660  0.0  0.2  61372  5332 ?        S    03:12   0:00 /usr/sbin/sshd -D
  root       669  0.0  0.4  37004  8892 ?        Sl   03:12   0:01 redis-server *:6379
  root       856  8.0  2.8 388720 57792 ?        Sl   04:07   0:18 /usr/local/bin/uwsgi --die-on-term --ini /var/www/conf/uwsgi.ini
  root       857  8.0  2.8 388720 57792 ?        Sl   04:07   0:18 /usr/local/bin/uwsgi --die-on-term --ini /var/www/conf/uwsgi.ini
  root       858  8.0  2.8 388720 57792 ?        Sl   04:07   0:18 /usr/local/bin/uwsgi --die-on-term --ini /var/www/conf/uwsgi.ini
  root       859  8.0  2.8 388720 57792 ?        Sl   04:07   0:18 /usr/local/bin/uwsgi --die-on-term --ini /var/www/conf/uwsgi.ini
  vagrant    889  0.0  0.1  18692  2508 ?        R+   04:11   0:00 ps aux
  </code></pre>