我有一个docker-compose文件,其中包含以下一般内容:
mongo:
image: mongoimage
expose:
- "27017"
ports:
- "27017:27017"
mysql:
image: mysqlimage
expose:
- "3306"
ports:
- "3306:3306"
data:
image: dataimage
memcached:
image: memcached
webserver:
image: webserverimage
ports:
- "80:80"
- "5000:5000"
- "12500:12500"
expose:
- "5000"
- "12500"
links:
- mongo
- mysql
- memcached
hostname: localtesting.dev
volumes_from:
- data
volumes:
- localvolume1:/mountedvolume1
- localvolume2:/mountedvolume2
- localvolume3:/mountedvolume3
- localvolume4:/mountedvolume4
- localvolume5:/mountedvolume5
testing:
image: testingimage
ports:
- "8080:80"
links:
- mongo
- mysql
- webserver:localtesting.dev
volumes_from:
- webserver
当我通过我们的本地测试套件运行时,该测试套件包含大量来自测试到网络服务器的http请求,大约需要1小时。
我将其修改为docker version 2:
version: '2'
services:
mongo:
image: mongoimage
expose:
- "27017"
ports:
- "27017:27017"
mysql:
image: mysqlimage
expose:
- "3306"
ports:
- "3306:3306"
data:
image: dataimage
memcached:
image: memcached
webserver:
image: webserverimage
ports:
- "80:80"
- "5000:5000"
- "12500:12500"
expose:
- "5000"
- "12500"
links:
- mongo
- mysql
- memcached
hostname: localtesting.dev
volumes_from:
- data
volumes:
- localvolume1:/mountedvolume1
- localvolume2:/mountedvolume2
- localvolume3:/mountedvolume3
- localvolume4:/mountedvolume4
- localvolume5:/mountedvolume5
testing:
image: testingimage
ports:
- "8080:80"
links:
- mongo
- mysql
- webserver:localtesting.dev
volumes_from:
- webserver
当我现在通过本地测试套件运行时,它突然需要大约6个小时,所有http请求都需要更长的时间。我应该做些什么网络更改来消除额外的延迟,以及它背后的实际原因是什么?