我有一个用 Angular 4 开发的 UI 应用程序。我还有一个服务超级登录和数据库沙发数据库。我正在从 Angular 4 应用程序向别名为 couchdb:5984 的沙发数据库发出请求,请求的状态为失败(失败)net:ERR_CONNECTION_REFUSED
回购:https ://github.com/janastu/iihs_couch_services
下面是我的 docker-compose.yml
version: '2'
volumes:
couchdb_data: {}
services:
# Build the container using the client Dockerfile
client:
build: ./client
# This line maps the contents of the client folder into the container.
ports:
- "80:80"
links:
- superlogin:superlogin
- couchdb:couchdb
couchdb:
environment:
- COUCHDB_USER:somename
- COUCHDB_PASSWORD:somepassword
volumes:
- ./client:/usr/src/app
# Build the container using the superlogin Dockerfile
superlogin:
build: ./superlogin> ports:
- "3000:3000"
# Link the client container so that Nginx will have access to it
links:
- couchdb:couchdb
couchdb:
environment:
- COUCHDB_USER:somename
- COUCHDB_PASSWORD:somepassword
image: klaemo/couchdb:1.6-couchperuser
ports:
- "5984:5984"
volumes:
- "couchdb_data:/usr/local/var/lib/couchdb"
所有容器都已启动并正在运行。如何从 Angular 4 应用程序的容器沙发数据库访问数据库?