使用docker-compose快速搭建mysql和redis

MYSQL

version: '3.1'
services:
  db:
    image: mysql
    restart: always
    environment:
    #root密码
      MYSQL_ROOT_PASSWORD: 123456
    command:
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
      --explicit_defaults_for_timestamp=true
      #不区分表名大小写
      --lower_case_table_names=1
    ports:
      - 3306:3306
    volumes:
      - ./data:/var/lib/mysql

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080

Redis

version: '3.1'
services:
  renode1:
    image: redis
    container_name: redis
    restart: always
    ports:
      - 6379:6379
    volumes:
      - ./date:/usr/local/etc/redis
      

你可能感兴趣的:(Docker)