我正在DigitalOcean上运行3个节点(1GB,具有私有网络),在部署此堆栈后,容器无法使用主机别名连接到其他容器。
以下是我的docker-compose.yml文件:
有什么想法,如何解决这个问题?
以下是我的docker-compose.yml文件:
version: "3"
services:
mongo:
image: mongo
ports:
- 27017:27017
networks:
mynet:
aliases:
- mongo
deploy:
placement:
constraints: [node.role == manager]
redis:
image: redis
ports:
- 6379:6379
networks:
mynet:
aliases:
- redis
deploy:
placement:
constraints: [node.role == worker]
app:
image: node
ports:
- 3030:3030
networks:
- mynet
depends_on:
- redis
- mongo
deploy:
mode: replicated
replicas: 2
placement:
constraints: [node.role == worker]
networks:
mynet:
问题
root@mongo-container:/# ping mongo # works
root@mongo-container:/# ping redis # doesn't work
root@redis-container:/# ping redis # works
root@redis-container:/# ping mongo # doesn't work
root@app-container:/# ping mongo # doesn't work
root@app-container:/# ping redis # doesn't work
Configuration
daemon.json
{ "userland-proxy": false }
docker version
:
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:50:14 2017
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:50:14 2017
OS/Arch: linux/amd64
Experimental: true
有什么想法,如何解决这个问题?