How to connect locally hosted MySQL databse with the docker container

I am using Ubuntu 16 and Docker version is

Client:
 Version:      17.04.0-ce
 API version:  1.28
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Mon Apr  3 18:07:42 2017
 OS/Arch:      linux/amd64
    
Server:
 Version:      17.04.0-ce
 API version:  1.28 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        Mon Apr  3 18:07:42 2017
 OS/Arch:      linux/amd64
 Experimental: false

Through docker-compose.yml I am able to run the application. Now we want to move the application to production, But we don’t want to use the container database. So is there any way so that I can connect my local MySQL database with the application using docker-compose?

My docker-compose.yml looks like:

version: '3'
services:
  web-app:
    build:
      context: .
      dockerfile: web-app/Dockerfile
      ports:
      - 8080:8080
    links:
      - app-db

app-db:
    build:
      context: .
      dockerfile: app-db/Dockerfile

    environment:
    - MYSQL_ROOT_PASSWORD=password
    - MYSQL_DATABASE=Optimize
    ports:
      - 3306:3306

after some suggestions i changed it as

version: '3'
services:
  web-app:
    build:
      context: .
      dockerfile: web-app/Dockerfile
    ports:
      - 8080:8080
      - "172.19.0.1:3306:3306" 

Here is my web-app’s Dockerfile

but still its not connecting to locally hosted MySQL. Here is the docker-compose logs

the host machine ip in the docker network is like

user@ubuntu:~/Opt-dock/web-app$ docker inspect 3b6c4bb36adc | grep Gateway
            "Gateway": "",
            "IPv6Gateway": "",
                    "Gateway": "172.19.0.1",
                    "IPv6Gateway": "",
user@ubuntu:~/Opt-dock/web-app$ 

In my applications hiberanate.properties file i have changed it as jdbc.url = jdbc:mysql://172.19.0.1:3306/optimize1

Can any one tell me what am i doing wrong.

you could have a look into extra-hosts option.
There you can specify your outer mysql service to the container.