📜  在 docker compose 文件中导入 sql - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:50.991000             🧑  作者: Mango

代码示例1
version: '3'

services:
  mysql:
    image: mariadb:10.3
    container_name: mariadb
    volumes:
      - container-volume:/var/lib/mysql
      - ./dump.sql:/docker-entrypoint-initdb.d/dump.sql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: name_db
    ports:
      - "3306:3306"

volumes:
  container-volume: