Docker: Percona how to populate thesql server with initial data

dockerpercona

I have created percona container in the following way:

docker run –name=sql -v
/path/to/dump:/tmp/dump:ro -d -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=config percona:5.6 mysqld
–max-allowed-packet=100M

Where the /tmp contains all data I need for restoring the dump. But I am getting error when trying to:

docker exec 75c4b8880156
/usr/bin/mysql -uroot config < /tmp/dump/performance_db.sql

bash: /tmp/dump/performance_db.sql: No such file or directory

Even despite the fact that the file is there:

$ docker exec 75c4b8880156 ls /tmp/dump/

performance_db.sql

And I can even less/tail the content 🙁

Best Answer

I suggest you to use the db initialization method recommended by Percona Docker image docs, "Initializing a fresh instance" section: put your init script in a directory mounted as /docker-entrypoint-initdb.d.