I am trying to connect to my host mysql from docker container but I don't know how to connect. I have a django project for that I followed Django Docker I am using this tutorial this one is working fine for djnago and postgres.
I am using mac and I am using mamp server I want to connect my djnago app to my host mysql.
My docker file code is:
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
And my docker compose file is:
version: '3'
services:
db:
image: postgres
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
This one is working fine but I am trying to connect my django app to my host mysql.
I don't know how to connect host mysql from my docker.