We are currently trying to find a more efficient way to deal with MySQL docker start up process and currently have the following:
FROM mysql ENV MYSQL_DATABASE marsdb COPY ./src/main/resources/ /docker-entrypoint-initdb.d/
echo "Building database image..." docker build -t marsdb -f Dockerfile.marsdb . echo "Starting database and removing old database container." docker rm -f marssql docker run -d -p 3306:3306 --name marssql -e MYSQL_ROOT_PASSWORD=pass marsdb
The issue with this setup is the following: Once the container is started someone would currently have to manually go into the container and select the database, in this case
marsdb like the following:
docker exec -it marssql bin/bash mysql -u root -p pass use marsdb;
Is there a way to auto select the database after the container launches?