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:-mysql3306} - MYSQL_USER=user - MYSQL_PASSWORD=${MYSQL_PASSWORD:-mysql3306} restart: always volumes: mysql_data: driver: local