0

I'm trying to setup a server to use ufw with docker (via dokku.) When ufw is enabled, I cannot open connections from one container to another. When it's disabled, I can connect fine.

As an example, I have a container running postgres, and another running my webapp. Connections from my webapp to postgres timeout when ufw is enabled. The connection string is: postgres://<myuser>:<mypass>@172.17.42.1:49155/db

I've followed the instructions here and changed the DEFAULT_FORWARD_POLICY from DROP to ACCEPT. I also tried making the changes to sysctl.conf outlined here. This isn't relevant because I'm not using prax.

UFW status:

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
2375/tcp                   ALLOW       Anywhere
80/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)
2375/tcp (v6)              ALLOW       Anywhere (v6)

Docker processes:

$ sudo docker ps
CONTAINER ID        IMAGE                                        COMMAND                CREATED             STATUS              PORTS                     NAMES
76f2bb181584        dokku/mysite:latest        /exec bash             About an hour ago   Up About an hour                              clever_mestorf                                                                                                                                                                                                                                                                           
0e9c3ec6fff6        dokku/mysite:latest        /exec bash             19 hours ago        Up 19 hours                                   focused_feynman                                                                                                                                                                                                                                                                          
4cbc630bba25        dokku/mysite:latest        /bin/bash -c '/start   19 hours ago        Up 19 hours         0.0.0.0:49158->5000/tcp   cranky_lovelace                                                                                                                                                                                                                                                                          
5072ed4bdc2a        redis/mysite:latest        /bin/start_redis.sh    19 hours ago        Up 19 hours         0.0.0.0:49157->6379/tcp   jovial_galileo                                                                                                                                                                                                                                                                           
0eab8d9a7fe1        postgresql/mysite:latest   /usr/bin/start_pgsql   19 hours ago        Up 19 hours         0.0.0.0:49155->5432/tcp   desperate_albattani                                                                                                                                                                                                                                                                      
2df00a075e89        jezdez/elasticsearch:latest                  /usr/local/bin/run     19 hours ago        Up 19 hours         9200/tcp, 9300/tcp        angry_carson/elasticsearch,clever_mestorf/elasticsearch,cranky_lovelace/elasticsearch,desperate_hypatia/elasticsearch,elasticsearch_mysite,elegant_shockley/elasticsearch,focused_feynman/elasticsearch,happy_heisenberg/elasticsearch,hungry_franklin/elasticsearch 

General computer info:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty
1
  • Look like you're trying to access a port that isn't forwarded. Try sudo ufw allow 49155/tcp and tell me if it worked.
    – Regan
    Sep 4, 2014 at 9:02

1 Answer 1

0

I would suggest you utilize the --link option to link the DB container into the containers that need it. That way you can just use the name given as the connection host... (--name the DB container and use the given name)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .