version: '3.8' services: web: build: . ports: - "5000:5000" depends_on: - db environment: - FLASK_ENV=development - DATABASE_URL=mysql+pymysql://username:password@db/mydatabase db: image: mysql:8.0 volumes: - db-data:/var/lib/mysql - ./init-db:/docker-entrypoint-initdb.d environment: MYSQL_ROOT_PASSWORD: rootpassword MYSQL_DATABASE: mydatabase MYSQL_USER: username MYSQL_PASSWORD: password volumes: db-data: