muerwre.github.io/content/Docker/Seed dump inside docker.md
2022-11-04 18:29:11 +06:00

15 lines
393 B
Markdown

If you need to seed `.sql` dump in #docker container, just run this command. Also you can try to [rsync file with SSH](/linux/Rsync%20file%20with%20SSH) to get it from remote host.
```shell
#####
# usage: ./script.sh "/path/to/dump.sql"
#####
DUMP_PATH=$1
CONTAINER="db"
USER=root
PASSWORD=password
DB=database
cat "$DUMP_PATH" | docker exec -i $CONTAINER mysql -u$USER -p$PASSWORD $DB
```