I have this setup in my docker-compose.yml -
db:
image: mysql:5.7.5
environment:
MYSQL_ROOT_PASSWORD: xxxxxx
MYSQL_DATABASE: development_db
volumes:
- /var/lib/mysql
ports:
- "3306:3306"
But docker-compose up is not creating the DB development_db in MySQL container.
Anything I could be doing incorrectly?
Ok I removed the containers shown in -
docker ps -a
And did a rebuild and re-ran docker-compose up
Looks like all is good now.
Maybe there's a quicker way to do this.
I know that this is an old issue, but it helped me solve my problem. The follow-up issue was that I was not able to execute the init script every time and here is a helpful SO for starting init script everytime.
Most helpful comment
Ok I removed the containers shown in -
docker ps -aAnd did a rebuild and re-ran
docker-compose upLooks like all is good now.
Maybe there's a quicker way to do this.