Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
一台主机上有多个停靠的angular应用程序_Angular_Docker_Traefik - Fatal编程技术网

一台主机上有多个停靠的angular应用程序

一台主机上有多个停靠的angular应用程序,angular,docker,traefik,Angular,Docker,Traefik,我试图在一台主机上承载指向不同环境的web控制台的相同映像的两个容器,并使用Traefik容器路由到它们。问题是,第二个容器无法访问。我的心情一直不好 使用第二个容器的端口导航到IP失败,但端口映射配置看起来很好。第二个容器中没有日志 docker compose console: container_name: console image: REDACTED environment: API_URL: "REDACTED-PRD" ports:

我试图在一台主机上承载指向不同环境的web控制台的相同映像的两个容器,并使用Traefik容器路由到它们。问题是,第二个容器无法访问。我的心情一直不好

使用第二个容器的端口导航到IP失败,但端口映射配置看起来很好。第二个容器中没有日志

docker compose

  console:
    container_name: console
    image: REDACTED
    environment:
      API_URL: "REDACTED-PRD"
    ports:
      - 4200:4200
    labels:
      - traefik.port=4200
      - traefik.frontend.rule=Host:dev.REDACTED.com
  console-prd:
    container_name: console-prd
    image: REDACTED
    environment:
      API_URL: "REDACTED-DEV"
    ports:
      - 4300:4200
    labels:
      - traefik.port=4300
      - traefik.frontend.rule=Host:app.REDACTED.com
  traefik:
    container_name: traefik
    image: traefik:1.7.10-alpine
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/etc/traefik/traefik.toml:Z```

ipaddr:4300 gets bad gateway. Traefik logs:

```time="2019-07-03T14:14:21Z" level=debug msg="Upstream ResponseWriter of type *pipelining.writerWithoutCloseNotify does not implement http.CloseNotifier. Returning dummy channel."
time="2019-07-03T14:14:21Z" level=debug msg="'502 Bad Gateway' caused by: dial tcp 192.168.16.3:4300: connect: connection refused"
time="2019-07-03T14:14:21Z" level=debug msg="vulcand/oxy/forward/http: Round trip: http://192.168.16.3:4300, code: 502, Length: 11, duration: 381.832µs tls:version: 303, tls:resume:true, tls:csuite:c02f, tls:server:app.REDACTED.com"
time="2019-07-03T14:14:21Z" level=debug msg="vulcand/oxy/forward/http: completed ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"http\",\"Opaque\":\"\",\"User\":null,\"Host\":\"192.168.16.3:4300\",\"Path\":\"\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/2.0\",\"ProtoMajor\":2,\"ProtoMinor\":0,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\"],\"Accept-Encoding\":[\"gzip, deflate, br\"],\"Accept-Language\":[\"en-US,en;q=0.9\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"app.REDACTED.com\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"148.78.240.30:50437\",\"RequestURI\":\"/\",\"TLS\":null}"
time="2019-07-03T14:14:21Z" level=debug msg="vulcand/oxy/forward: completed ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"http\",\"Opaque\":\"\",\"User\":null,\"Host\":\"192.168.16.3:4300\",\"Path\":\"\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/2.0\",\"ProtoMajor\":2,\"ProtoMinor\":0,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\"],\"Accept-Encoding\":[\"gzip, deflate, br\"],\"Accept-Language\":[\"en-US,en;q=0.9\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"app.REDACTED.com\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"148.78.240.30:50437\",\"RequestURI\":\"/\",\"TLS\":null}"
time="2019-07-03T14:14:21Z" level=debug msg="vulcand/oxy/roundrobin/rr: completed ServeHttp on request" Request="{\"Method\":\"GET\",\"URL\":{\"Scheme\":\"\",\"Opaque\":\"\",\"User\":null,\"Host\":\"\",\"Path\":\"/\",\"RawPath\":\"\",\"ForceQuery\":false,\"RawQuery\":\"\",\"Fragment\":\"\"},\"Proto\":\"HTTP/2.0\",\"ProtoMajor\":2,\"ProtoMinor\":0,\"Header\":{\"Accept\":[\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\"],\"Accept-Encoding\":[\"gzip, deflate, br\"],\"Accept-Language\":[\"en-US,en;q=0.9\"],\"Upgrade-Insecure-Requests\":[\"1\"],\"User-Agent\":[\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36\"]},\"ContentLength\":0,\"TransferEncoding\":null,\"Host\":\"app.REDACTED.com\",\"Form\":null,\"PostForm\":null,\"MultipartForm\":null,\"Trailer\":null,\"RemoteAddr\":\"148.78.240.30:50437\",\"RequestURI\":\"/\",\"TLS\":null}"```

标签中的traefik端口也应为4200。Traefik未使用发布的端口

标签中的Traefik端口也应为4200。Traefik没有使用发布的端口

Ah,认为这会标记到主机端口,而不是容器的公开端口。非常感谢。如果您同时启动traefik as容器,它将无法连接到主机端口。您还可以删除文件中已发布的端口。这仍然应该有效。啊,我想这会标记到主机端口,而不是容器的暴露端口。非常感谢。如果您同时启动traefik as容器,它将无法连接到主机端口。您还可以删除文件中已发布的端口。这仍然应该有效。