来自具有docker组合的容器之间的请求的未定义的http响应

时间:2016-11-12 00:48:57

标签: http docker docker-compose

我正在尝试使用docker compose为API设置CI测试环境。我有两个docker文件,一个用于运行API,另一个用于我的测试。两者都正常运行和执行,但是当尝试从测试容器访问API的url时,我无法执行未定义的http请求作为响应。

使用默认桥接连接它们。 API正在80:80端口转发,我能够获取我的localhost和API容器的bash中的数据。我尝试了多种不同版本的测试容器来测试API:

api-internal/login
api-internal:80/login
ci_api-internal_1/login
ci_api-internal_1:80/login
172.18.0.2/login

搬运工-compose.yml:

    version: '2'

services:
  api-internal:
    build: .
    ports:
      - "80:80"
    volumes:
      - .:/var/www
    environment:
      - NODE_ENV=local
  ci:
    build: ./integration-test
    volumes_from:
      - api-internal

网络:

"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
    "Driver": "default",
    "Options": null,
    "Config": [
        {
            "Subnet": "172.18.0.0/16",
            "Gateway": "172.18.0.1"
        }
    ]
},
"Internal": false,
"Containers": {
    "9249966d1b111b61959c3e1afdbb3b7d86267469e51aa372c614448fecee2532": {
        "Name": "ci_ci_1",
        "EndpointID": "a3d1edc1759fddc9a887ae68b3c9504f653ce427c3e2f8fb818a8c9dd7701d25",
        "MacAddress": "02:42:ac:12:00:03",
        "IPv4Address": "172.18.0.3/16",
        "IPv6Address": ""
    },
    "c950d69ce73b46e1d5cabe6811a27675f497a01518c03595d5b892756ba3066c": {
        "Name": "ci_api-internal_1",
        "EndpointID": "b8f3fad279eeeaeac50a5639bec2468272a9dc3e0635f60faee7accb9b908c4c",
        "MacAddress": "02:42:ac:12:00:02",
        "IPv4Address": "172.18.0.2/16",
        "IPv6Address": ""
    }
}

0 个答案:

没有答案