- Mysql:
+ import: docker exec -i mysql_container mysql -uusername -ppassword mysql < db.sql (lưu ở host)
+ export: docker exec mysql /usr/bin/mysqldump -u username --password=password database_name> db.sql (lưu ở host)
- Mongodb:
+ import: mongorestore -u username -p password --authenticationDatabase=admin -d database_name./mongo-backup/mydb (lưu ở container)
+ export: mongodump -u username -p password --authenticationDatabase=admin -d database_name -o /tmp/backup (lưu ở container)
- command copy file or folder in docker:
+ container to host: docker cp <container_name>:/path ./path/host
+ host to container: docker cp src_path container:dest_path
+ copy all file into folder: cp -rf ./folder/* ./