version: "3" services: mysql: image: mysql:8 container_name: 'mysql' hostname: 'mysql' ports: - "3306:3306" volumes: - mysql_data:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root} - MYSQL_USER=user - MYSQL_PASSWORD=${MYSQL_PASSWORD:-user} restart: always volumes: mysql_data: driver: local