Import a MySQL Database

This example assumes that there is a mysqldump file available somewhere via SSH.

First, import the Tugboat Repository’s SSH key to the server hosting the file.

Then, use this snippet in your configuration file to import the database into a service named “mysql”.

services:
  mysql:
    image: tugboatqa/mysql:5-debian
    commands:
      init:
        - scp example.com/database.sql.gz /tmp/
        - zcat /tmp/database.sql.gz | mysql tugboat
        - rm /tmp/database.sql.gz