hi i create project with .net core.my project connect to other project to get services.i read docker-compose and set network for projects.in windows os my project correctly connect to other project and get services.i set ip 127.0.0.1
to connect to other project.in linux i see ip docker container projects like this
docker network inspect my_project_net
and see
"IPv4Address": "172.18.0.5/16",
"IPv6Address": ""
and get this error when my project connect to other projects
Connection refused [::ffff:127.0.0.1]:port // port is 105
how i can cast this port to 127.0.0.1 or run correctly my project thanks for read my problem
you must set container_name in docker-compose to environment project that connects to another project for example:
version: '3.3'
services:
proj1:
container_name: proj-1
image: ...
ports:
- "5002:5002"
- "8443:8443"
environment:
- ConnectionString=Data Source=127.0.0.1,14330;Initial Catalog=db;
User id=sa;Password=******; // in docker-compose you must use (container_name) mssql insted 127.0.0.1
- ConnectionString=Data Source=mssql,14330;Initial Catalog=db;
User id=sa;Password=******; // true
restart: always
depends_on:
- mssqlservice
restart: always
mssqlservice:
image: 'mcr.microsoft.com/mssql/server:2019-CU3-ubuntu-18.04'
container_name: mssql
environment:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: ******
volumes:
- sqlvolume:/var/opt/mssql
expose:
- 1433
ports:
- "14330:1433"
restart: always
volumes:
sqlvolume:
driver: local
name: mssqldata
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.