I am setting up an application with the Flask framework using MySQL as the database. This database is located locally on the machine. I manage to use the occifielle image of MySQL without problem. Only that I would rather use a local database that is on my computer. Here is my extract, please help me.
Dockerfile
FROM python:3.9-slim
RUN apt-get -y update 
RUN apt install python3-pip -y
WORKDIR /flask_docker_test
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 80
CMD gunicorn --bind 0.0.0.0:5000 app:app
Docker-compose file
version: "3"
services:
  app:
    build: .
    container_name: app
    links:
      - db
    ports:
      - "5000:5000"
    depends_on:
      - db
    networks:
      - myapp
  db:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    container_name: mysql_db
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: flask_test_db
      MYSQL_USER: eric
      MYSQL_PASSWORD: 1234
    ports:
      - "3306:3306"
    networks:
      - myapp
  phpmyadmin:
    image: phpmyadmin
    restart: always
    ports:
      - 8080:80
    depends_on:
      - db
    environment:
      PMA_ARBITRARY: 1
      PMA_USER: serge
      PMA_HOST: db
      PMA_PASSWORD: 1234
    networks:
      - myapp
networks:
  myapp:
I would like to establish a connection with my local database rather than with the database provided by the MySQL container
 
    