Unable to install mysql with gitlab CI for django docker (django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on 'db' (115)"))

My project is running on docker and working fine on my local machine but its giving this error on gitlab CI

django.db.utils.OperationalError: (2002, “Can’t connect to MySQL server on ‘db’ (115)”)

My docker-compose is like

version: '3'

services:
  nginx:
    image: nginx:alpine
    container_name: nz01
    ports:
      - "8080:80"
    volumes:
      - ./todolist:/todolist
      - ./config/nginx:/etc/nginx/conf.d
    depends_on:
      - web

  rabbitmq:
    image: rabbitmq:latest
    hostname: rabbitmq
    volumes:
      - /var/lib/rabbitmq:/var/lib/rabbitmq
    ports:
      - "5672:5672"
      - "15672:15672"

  db:
    image: mysql:5.7
    restart: always
    env_file:
      - ./todolist/todolist/.env
    volumes:
      - ./mysql-data:/var/lib/mysql
    ports:
    - "3306:3306"
  web:
    build:
      context: .
    command: >
       bash -c "rm -rf celerybeat.pid &&
       python3 manage.py migrate --run-syncdb &&
       python3 manage.py runserver 0.0.0.0:8000"
    volumes:
      - ./todolist:/todolist
    ports:
      - "8000:8000"
    depends_on:
      - "db"
      - rabbitmq

  celery:
    build: .
    command: celery -A todolist worker -l info
    volumes:
       - ./todolist:/todolist
    depends_on:
      - db
      - rabbitmq
  celery-beat:
    build: .
    command: celery -A todolist beat -l info
    volumes:
      - ./todolist:/todolist
    depends_on:
      - db
      - rabbitmq
      - celery

  memcached:
    image: memcached:latest
    ports:
      - "11211:11211"
    entrypoint:
      - memcached
      - -m 64

My gitlab-ci.yml is like

image: docker:latest
services:
  - docker:dind

variables:
  DOCKER_HOST: tcp://docker:2375
  DOCKER_DRIVER: overlay2
  CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_SLUG
  CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest

stages:
  - test
  - build
  - release

test:
  stage: test