Reverse proxy apache can't contact one of my docker

Good morning

I have a problem with loomio docker environment in my local network and it’s seems that it’s a docker problems.

This is my network configuration:

172.16.0.15 is my apache reverse proxy server (fixed IP)
172.16.0.85 is my vm (ubuntu server 14.04 LTS) who host loomio (fixed IP)
172.17.0.xxx is loomio-docker in the host 172.16.0.85

172.16.0.15 can contact and speak with 172.16.0.85 (loomio works on port 80 and 443)

the network config on the host:

docker0   Link encap:Ethernet  HWaddr 02:42:08:6d:dc:00
          inet adr:172.17.0.1  Bcast:0.0.0.0  Masque:255.255.0.0
          adr inet6: fe80::42:8ff:fe6d:dc00/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:27983 erreurs:0 :0 overruns:0 frame:0
          TX packets:32649 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:34422152 (34.4 MB) Octets transmis:14697907 (14.6 MB)eth0      Link encap:Ethernet  HWaddr 00:15:5d:00:02:27
          inet adr:172.16.0.85  Bcast:172.16.0.255  Masque:255.255.255.0
          adr inet6: fe80::215:5dff:fe00:227/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:281033 erreurs:0 :0 overruns:0 frame:0
          TX packets:41802 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          Octets reçus:53750761 (53.7 MB) Octets transmis:43144793 (43.1 MB)lo        Link encap:Boucle locale
          inet adr:127.0.0.1  Masque:255.0.0.0
          adr inet6: ::1/128 Scope:Hôte
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          Packets reçus:0 erreurs:0 :0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:0 (0.0  Octets transmis:0 (0.0 veth0256652 Link encap:Ethernet  HWaddr 62:f0:9b:58:f6:82
          adr inet6: fe80::60f0:9bff:fe58:f682/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:11 erreurs:0 :0 overruns:0 frame:0
          TX packets:94 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:806 (806.0  Octets transmis:6808 (6.8 KB)veth275b50c Link encap:Ethernet  HWaddr ce:a2:fd:c5:22:d8
          adr inet6: fe80::cca2:fdff:fec5:22d8/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:42715 erreurs:0 :0 overruns:0 frame:0
          TX packets:39880 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:26363606 (26.3 MB) Octets transmis:22338487 (22.3 MB)veth616846c Link encap:Ethernet  HWaddr ca:a5:e9:d1:6f:12
          adr inet6: fe80::c8a5:e9ff:fed1:6f12/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:41002 erreurs:0 :0 overruns:0 frame:0
          TX packets:22936 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:11893852 (11.8 MB) Octets transmis:12705718 (12.7 MB)veth6a027a8 Link encap:Ethernet  HWaddr a2:66:b3:e8:a7:39
          adr inet6: fe80::a066:b3ff:fee8:a739/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:39717 erreurs:0 :0 overruns:0 frame:0
          TX packets:65467 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:27534142 (27.5 MB) Octets transmis:15804611 (15.8 MB)veth7e4b7d2 Link encap:Ethernet  HWaddr fef5:c3:b0:e3
          adr inet6: fe80::fcae:f5ff:fec3:b0e3/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:8 erreurs:0 :0 overruns:0 frame:0
          TX packets:83 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:648 (648.0  Octets transmis:5966 (5.9 KB)vetha59ebbf Link encap:Ethernet  HWaddr 2a:ef:c8:0e:90:e7
          adr inet6: fe80::28ef:c8ff:fe0e:90e7/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:46 erreurs:0 :0 overruns:0 frame:0
          TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:4085 (4.0 KB) Octets transmis:12561 (12.5 KB)vethfe379a4 Link encap:Ethernet  HWaddr ea:b5:20:f1:29:30
          adr inet6: fe80::e8b5:20ff:fef1:2930/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Packets reçus:37055 erreurs:0 :0 overruns:0 frame:0
          TX packets:35968 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:0
          Octets reçus:31354010 (31.3 MB) Octets transmis:29548419 (29.5 MB)

this is the iptable of my host VM (iptables modified my loomio docker install)

Chain INPUT (policy ACCEPT)
target     prot opt source               destinationChain FORWARD (policy ACCEPT)
target     prot opt source               destination
DOCKER-ISOLATION  all  --  anywhere      anywhere
DOCKER     all  --  anywhere       anywhere
ACCEPT     all  --  anywhere       anywhere      ctstate      RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhereChain OUTPUT (policy ACCEPT)
target     prot opt source       destinationChain DOCKER (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere     172.17.0.6           tcp dpt:prospero-np
ACCEPT     tcp  --  anywhere     172.17.0.7           tcp dpt:https
ACCEPT     tcp  --  anywhere     172.17.0.7           tcp dpt:httpChain DOCKER-ISOLATION (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere   anywhere

and the result of docker ps

 docker ps
CONTAINER ID        IMAGE                                    COMMAND                  CREATED             STATUS              PORTS                                      NAMES
78b613fbfd13        jrcs/letsencrypt-nginx-proxy-companion   "/bin/bash /app/entry"   4 days ago          Up 4 days                                                      loomiodeploy_letsencrypt_1
8fdffc733c98        jwilder/nginx-proxy                      "/app/docker-entrypoi"   4 days ago          Up 4 days           0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   loomiodeploy_nginx_1
4316c234e4a4        loomio/mailin-docker                     "/bin/sh -c 'mailin -"   4 days ago          Up 4 days           25/tcp, 0.0.0.0:32771->1525/tcp            loomiodeploy_mailin_1
2802fe7ed964        loomio/loomio                            "/bin/sh -c 'bundle e"   4 days ago          Up 4 days           3000/tcp                                   loomiodeploy_loomio_1
ea4d32fe9d68        loomio/loomio                            "bundle exec rake job"   4 days ago          Up 4 days           3000/tcp                                   loomiodeploy_worker_1
89092afa104f        postgres                                 "/docker-entrypoint.s"   4 days ago          Up 4 days           5432/tcp                                   loomiodeploy_db_1
8d5c3c389839        loomiodeploy_faye                        "/bin/sh -c 'thin --p"   4 days ago          Up 4 days           3000/tcp                                   loomiodeploy_faye_1

this is my apache reverse proxy config:

## Config reverse proxy loomio ##
<VirtualHost 172.16.0.15:80>
     ServerName loomio.domain.lan
     ServerAlias loomio.domain.com
     ProxyPreserveHost On
     ProxyRequests off
     ProxyPass / http://172.16.0.85:80/
     ProxyPassReverse / http://172.16.0.85:80/
     ErrorLog /var/log/apache2/loomio-error.log
     LogLevel warn
     CustomLog /var/log/apache2/loomio-access.log combined
</VirtualHost>

<VirtualHost 172.16.0.15:443>
     ServerName loomio.domain.lan
     ServerAlias loomio.domain.com
     SSLEngine On
     SSLCertificateFile /etc/apache2/SSL/loomio.pem
     SSLCertificateKeyFile /etc/apache2/SSL/loomio.key
     ErrorLog /var/log/apache2/loomio-error.log
     LogLevel warn
     CustomLog /var/log/apache2/loomio-access.log combined
     SSLProxyEngine On
     SSLProxyVerify none
     SSLProxyCheckPeerCN off
     SSLProxyCheckPeerName off
     SSLProxyCheckPeerExpire off
     ProxyRequests     Off
     ProxyPreserveHost On
     ProxyPass         / https://172.16.0.85:443/ keepalive=On retry=5
     ProxyPassReverse  / https://172.16.0.85:443/
</VirtualHost>

<VirtualHost 172.16.0.15:80>
     ServerName faye.loomio.domain.lan
     ServerAlias faye.loomio.domain.com
     ProxyPreserveHost On
     ProxyRequests off
     ProxyPass / http://172.16.0.85:80/
     ProxyPassReverse / http://172.16.0.85:80/
     ErrorLog /var/log/apache2/loomio-error.log
     LogLevel warn
     CustomLog /var/log/apache2/loomio-access.log combined
</VirtualHost>

<VirtualHost 172.16.0.15:443>
     ServerName faye.loomio.domain.lan
     ServerAlias faye.loomio.domain.com
     SSLEngine On
     SSLCertificateFile /etc/apache2/SSL/loomio.pem
     SSLCertificateKeyFile /etc/apache2/SSL/loomio.key
     ErrorLog /var/log/apache2/loomio-error.log
     LogLevel warn
     CustomLog /var/log/apache2/loomio-access.log combined
     SSLProxyEngine On
     SSLProxyVerify none
     SSLProxyCheckPeerCN off
     SSLProxyCheckPeerName off
     SSLProxyCheckPeerExpire off
     ProxyRequests     Off
     ProxyPreserveHost On
     ProxyPass         / https://172.16.0.85:443/ keepalive=On retry=5
     ProxyPassReverse  / https://172.16.0.85:443/
</VirtualHost>

The problem is that i always have this type of error in my loomio logs

nginx_1
       | nginx.1    | 2016/06/01 07:19:04 [error] 41#41: *13 connect() 
failed (111: Connection refused) while connecting to upstream, 
client:172.16.0.15, server: loomio.mydomain.com, request: "GET 
/client/0.20.4/app.min.css HTTP/1.1", upstream: "http://172.17.0.4:3000/client/0.20.4/app.min.css", host: "loomio.mydomain.com", referrer: "https://loomio.mydomain.com/d/xPfHy1Rh/mypost_test-"

I am a full beginner on docker, this is my first install by using it

Please can you help me to resolved this problem of connection between my 2 servers

Don’t hesitate to ask me more informations, and please give me command line to have the result.

Thank you for your help

Edit: nobody have an idea of the origin of my problem?

up :disappointed_relieved: