Why isn't my port exposed? netstat output included

437 views Asked by At

This is my problem

# docker exec -ti root_web_1 bash
[root@ca32f79bdc14]# curl couchdb:5984
curl: (7) Failed to connect to couchdb port 5984: Connection refused
[root@ca32f79bdc14]# curl redis:6379  
-ERR wrong number of arguments for 'get' command
-ERR unknown command 'Host:'
-ERR unknown command 'User-Agent:'
-ERR unknown command 'Accept:'
^C

Question

Why can't I access couchdb:5984 ?

Background

When I am in my couchdb container I can curl localhost:5984 and it responds and netstat -nl gives me

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:5984          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.11:35300        0.0.0.0:*               LISTEN
udp        0      0 127.0.0.11:51267        0.0.0.0:*

and the Dockerfile contains EXPOSE 5984, but I get connection refused when doing curl couchdb:5984 from the web container.

When I do the same with redis, curl redis:6379 it responds and netstat -nl gives

Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.11:46665        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN
tcp6       0      0 :::6379                 :::*                    LISTEN
udp        0      0 127.0.0.11:49518        0.0.0.0:*

This is the couchdb Dockerfile

FROM fedora:25
RUN dnf -y update
RUN dnf -y install couchdb
EXPOSE 5984
CMD ["/usr/bin/couchdb"]

This is the docker-compose.yml.

version: '2'
networks:
  revproxynet:
    external: true
services:
  web:
    images: nginx
    networks:
      - revproxynet
  redis:
    image: redis
    networks:
      - revproxynet
  couchdb:
    build: /docker/couchdb/
    networks:
      - revproxynet

The network is created with docker network create revproxynet.

1

There are 1 answers

0
d2xdt2 On BEST ANSWER

In /etc/couchdb/local.ini you need to have

[httpd]
bind_address = 0.0.0.0

and it will work.