Hello everyone i am just beginning docker and really appreciate the whole container concepts but one thing i cant seem to figure out is that when i use docker compose to define my services i have to give a network also and all containers connect to that network and hence are reachable to one another but what if my one service needs to connect to a database service hosted on localhost.How will my service be able to reach the database i have searched about networking mode host and net:host options in compose file but they don't seem to work my docker version info is as follows.
Client: Docker Engine - Community
Version:           18.09.2
API version:       1.39
Built:             Sun Feb 10 04:12:31 2019
OS/Arch:           windows/amd64
Experimental:      false
Server: Docker Engine - Community
Engine:
 Version:          18.09.2
 API version:      1.39 (minimum version 1.12)
 Built:            Sun Feb 10 04:13:06 2019
 OS/Arch:          linux/amd64
 Experimental:     false
my docker-compose.yml file
version: "3"
services:
 web:
   # replace username/repo:tag with your name and image details
   image: dbaccessserviceimage
   network_mode: "host"
   deploy:
     replicas: 5
     resources:
       limits:
         cpus: "0.1"
         memory: 50M
     restart_policy:
       condition: on-failure
   ports:
     - "4000:80"
Really need help as i am designing the architecture to move all our production into containers A docker compose file with appropriate version and network option would be highly appreciated.
 
    