I have a docker exec command that tries to import a SQL dump file but it's complaining about the file not being found.
docker exec $DB_CONTAINER mysql -u root -ptest < /path/to/database.sql
The path is correct (inside the container) but when I investigated why this was not working, I figured that it was trying to look for the file from my host system instead of the container where the file is actually located. How do I import this file and make sure that it looks at the container file system instead of my host file system.
The
<is being interpreted by the shell that's about to executedocker./path/to/database.sql.Then the filename has to make it inside the container. You have a few options:
Invoke a shell on the container and have the shell handle the redirection to mysql.