Dockers MySQL-image kan automatisk importere .sql-filer placeret i /docker-entrypoint-initdb.d. Med Docker Compose monterer du en lokal dump-mappe til den sti.
version: '3.1' services: db: image: mysql command: --default-authentication-plugin=mysql_native_password restart: always volumes: - ./mysql-dump:/docker-entrypoint-initdb.d environment: MYSQL_ROOT_PASSWORD: example MYSQL_DATABASE: ecommerce adminer: image: adminer restart: always ports: - 8080:8080Mappen mysql-dump skal findes lokalt. Alle SQL-filer indeni importeres under containerens initialisering.