How to install package like Mysql in order to run command into boot2docker but outside the containers

I’d like to execute a script but my script require Mysql commands. Is it possible to use a mysql command into boot2docker??

Thank’s for your answers


MySQL runs within your docker container and not within boot2docker. So you can use a docker exec command. In my shell script I use the following command to execute MySQL commands to create a MySQL database and import an SQL file.

docker exec -dt mycontainer sh -c ‘echo “create database mydatabase” | mysql -uroot && mysql -hlocalhost -uroot mydatabase < /var/www/html/sql/mysqlfile.sql’

I hope this helps!