Download Database, Unzip, Copy to Docker Container and Import Data


# downloading db.sql.gz
wget http://path/to/your/db.sql.gz

# Unzip
gzip -d db.sql.gz

# Start container
docker-compose up -d

# copy db.sql into the local-db container
docker cp db.sql local-db:/docker/

# remove the downloaded file
rm db.sql

docker exec -it local-db echo "Importing db.sql into the container ..."
docker exec -it local-db /bin/sh -c 'mysql -uadmin -pPassword my_database < db.sql'
docker exec -it local-db /bin/sh -c 'rm db.sql'


Done!