Basically, links is no longer needed because its main purpose, making container reachable by another by adding environment variable, is included implicitly with network. When containers are placed in the same network, they are reachable by each other using their container name and other alias as host.
links 是为了添加环境变量使容器可以被其他容器访问。当容器在同一个容器中,可以使用容器名和其他别名来访问作为主机互相访问,
denpends on 是为了解决开始顺序
当某个image依赖其他db或者nosql或者其他的譬如eureka之类的
需要加入在Dockerfile里面加入 ,这些给依赖者,来配置、
eg:
docker run -d --name=vote -p 5000:80 --link redis:redis voting-app
在docker=compose里面
vote:
image: voting-app
ports:
- 5000:80
links:
- redis:redis
// 当然如果是the same name as the target name
vote:
image: voting-app
ports:
- 5000:80
links:
- redis
