使用docker-compose部署MySQL数据库

services:
  mysql:
    command:
      - "mysqld"
    container_name: "mysql"
    entrypoint:
      - "docker-entrypoint.sh"
    environment:
      - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      - "GOSU_VERSION=1.12"
      - "MYSQL_MAJOR=8.0"
      - "MYSQL_VERSION=8.0.20-1debian10"
      - "MYSQL_ROOT_PASSWORD=wsh@9210832"
    hostname: "mysql"
    image: "mysql:8.0.20"
    ipc: "private"
    logging:
      driver: "db"
      options: {}
    mac_address: "02:42:ac:11:00:06"
    network_mode: "bridge"
    ports:
      - "3306:3306/tcp"
      - ":33060/tcp"
    privileged: true
    restart: "always"
    security_opt:
      - "label=disable"
    stdin_open: true
    tty: true
    volumes:
      - "16d331fd0193b15387d73f87fa13207fe960c933cf7b66391a97e7b383ca982d:/var/lib/mysql"
version: "3.6"
volumes:
  16d331fd0193b15387d73f87fa13207fe960c933cf7b66391a97e7b383ca982d:
    external: true