linux-为什么我的端口没有暴露?包括netstat输出
作者:互联网
这是我的问题
# 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
题
为什么我不能访问ouchdb:5984?
背景
当我在沙发床容器中时,我可以卷曲localhost:5984,它会响应,并且netstat -nl给我
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:*
并且Dockerfile包含EXPOSE 5984,但是从Web容器执行curl benchdb:5984时,连接被拒绝.
当我对redis进行相同操作时,卷曲redis:6379它会响应,并且netstat -nl会给出
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:*
这是couchdb Dockerfile
FROM fedora:25
RUN dnf -y update
RUN dnf -y install couchdb
EXPOSE 5984
CMD ["/usr/bin/couchdb"]
这是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
使用docker network create revproxynet创建网络.
解决方法:
在/etc/couchdb/local.ini中,您需要具有
[httpd]
bind_address = 0.0.0.0
它会工作.
标签:netstat,docker,docker-compose,networking,linux 来源: https://codeday.me/bug/20191026/1936306.html