Compose services only can connect to each other by IP
Here is my Compose File
version: '2.1'
services:
NotificationProcessor:
image: notificationprocessor
restart: unless-stopped
depends_on:
- SQLServer
mem_limit: 2G
environment:
DataSource: SQLServer
DBName: IODC_Central
DBIntegratedSecurity: "false"
DBUserid: sa
DBPassword: LoveDocker
SQLServer:
image: microsoft/mssql-server-windows-developer
restart: unless-stopped
ports:
- "1433:1433"
volumes:
- "C:/Base_4_0_Database/:C:/Base_4_0_Database/"
environment:
sa_password: LoveDocker
ACCEPT_EULA: Y
attach_dbs: "[{'dbName':'IODC_Central','dbFiles':['C:\\\\Base_4_0_Database\\\\IODC_Central.mdf','C:\\\\Base_4_0_Database\\\\IODC_Central_log.ldf']}]"
Sadly the notification processor can only connect to database if I run the SQL container first then get its IP replace
DataSource: SQLServer
with
DataSource: 172.26.0.120 (example of a randomly generated ip) inside of the compose file and then compose up the notification processor
It should be able to connect to it using the service name so that I could call docker-compose up and it would connect. Anyone have any guidance?
I would try using only lowercase characters in your service names. Upper case for host names isn't well supported. Let me know if that helps.
Yoo shin you are the man ! You have answered so many of my questions indirectly just by being so involved with so many post and answering other questions (frism also he has helped me alot). Seen you alot around the forums and want to give you a solid thank you for your time and help. Lower casing it did work for me. TY !
Glad I could help :blush: