I'm trying to containerize my .net core 3.1 service into linux Docker container. So I have a docker-compose
as follows:
version: "3.5"
services:
back:
build:
context: ../../
dockerfile: local_deploy/back/docker
container_name: api
restart: always
environment:
- ASPNETCORE_ENVIRONMENT=Development
depends_on:
- db-server
links:
- nats
ports:
- "7000:80"
networks:
- localdev
db-server:
image: microsoft/mssql-server-linux:2017-latest
container_name: db-server
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=1234
- MSSQL_TCP_PORT=1433
ports:
- "1400:1433"
networks:
- localdev
nats:
image: 'nats:0.8.0'
entrypoint: "/gnatsd -DV"
expose:
- "4222"
ports:
- "8222:8222"
- "6222:6222"
- "4222:4222"
networks:
- localdev
networks:
localdev:
name: localdev
But the service also uses NATS Streaming. So, when I run containers I get an error:
STAN.Client.StanConnectRequestTimeoutException: No response from a
streaming server with a cluster ID of 'stan-eas' at
STAN.Client.Connection..ctor(String stanClusterID, String clientID,
StanOptions options)
I tried to add nats-streaming to my docker-compose
and indicated cluster id via -cid
flag like this:
version: "3.5"
services:
// another services omitted for brevity
nats-0:
container_name: nats-0
hostname: nats-0
image: nats-streaming:0.11.2-linux
depends_on:
- nats
networks:
- localdev
command: -p 4224 -m 8224 -cid stan-eas -store file -dir /datastore -user some_user -pass some_password -ft_group "ft" -cluster nats://nats-0:6222 -routes nats://nats-1:6223
volumes:
- ~/volumes/cherry/data/nats/nats-0:/datastore
ports:
- 4224:4224
- 8224:8224
nats-1:
container_name: nats-1
hostname: nats-1
image: nats-streaming:0.11.2-linux
depends_on:
- nats
networks:
- localdev
command: -p 4223 -m 8223 -cid stan-eas -store file -dir /datastore -user some_user -pass some_password -ft_group "ft" -cluster nats://nats-1:6223 -routes nats://nats-0:6222
volumes:
- ~/volumes/cherry/data/nats/nats-0:/datastore
ports:
- 4223:4223
- 8223:8223
networks:
localdev:
name: localdev
but the same error still occurs.
Any help would be highly appreciated.
question from:
https://stackoverflow.com/questions/65869717/stan-client-stanconnectrequesttimeoutexception-no-response-from-a-streaming-ser 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…