Confused about networks and database

I have put my database in a compose file. I aim to start my database locally and have it separate from my other apps which will use it.

I have several other apps which will use this database instance, each with their own database in it.

I can start my database ok and I can connect to it from the host on localhost. However whenever my app starts in its own container it cannot seem to connect to the database. I am trying to use networks to do this.

Here is the compose for the database:

version: "3"
services:
  mssql:
      image: 'microsoft/mssql-server-linux'
      ports:
          - '1433:1433'
      environment:
          - ACCEPT_EULA=Y
          - SA_PASSWORD=Some1234Pw
      volumes:
          - local_db:/var/lib/mssql/data
      networks:
          - my_docker_network
volumes:
  local_db:
networks:
    my_docker_network:

as you can see I am using sql server linux.

My app looks like this, is there a problem with my network. I am trying to use localhost to connect to it, I have also tried using the service name of ‘mssql’ in my database config. Should I be using something else?

This is my app compose:

version: "3"
services:
  web:
    build:
      context: .
      args:
        http_proxy: ${http_proxy}
        https_proxy: ${https_proxy}
        no_proxy: ${HTTPS_PROXY_FROM_ENV:-192.168.2.2}
    command: bundle exec rails s -b 0.0.0.0
    volumes:
      - .:/app
    ports:
      - "3000:3000"

networks:
  outside:
    external:
      name: my_docker_network

Am I missing anything?

I got this working - it looks like the network name is prepended with the docker name!

e.g. mssql_docker_my_docker_network. I needed to add this network name as an external network in my app compose file.

You can close this question if needed.