Untitled
services: mysql: image: mysql:latest restart: always container_name: mysql environment: MYSQL_ROOT_PASSWORD: password # Set the root password for MySQL MYSQL_DATABASE: my_database # Create a default database MYSQL_USER: user # Create a new MySQL user MYSQL_PASSWORD: user_password # Set the password for the new MySQL user ports: - "3306:3306" # Maps port 3306 of the host to port 3306 of the container volumes: - mysql_data:/var/lib/mysql # Persist MySQL data - ./data:/var/lib/mysql # Persist MySQL data networks: - server # phpMyAdmin Service phpmyadmin: image: phpmyadmin/phpmyadmin:latest restart: always container_name: phpmyadmin ports: - "8080:80" # Maps port 8080 of the host to port 80 of the container environment: PMA_HOST: mysql # The name of the MySQL service as defined in the docker-compose file PMA_PORT: 3306 # The port MySQL is running on depends_on: - mysql networks: - server volumes: mysql_data: networks: server: driver: bridge
Leave a Comment