Mysql: Mysql database not getting created on docker-compose up

Created on 19 Sep 2015  路  2Comments  路  Source: docker-library/mysql

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?

Most helpful comment

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.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings