Skip to content

database not initialized when run via docker-compose #171

@cjrollo

Description

@cjrollo

MySQL version: 5.7.12

I send this via command line and the "demo" database is created, as is the "demouser" user:

docker run -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=demo -e MYSQL_USER=demouser -e MYSQL_PASSWORD=demopassword -d mysql:5.7.12

When I run via docker-compose, the "demo" database is not created. Here is the relevant info from docker-compose.yml:

db:
  image: mysql:5.7.12
  environment:
    - MYSQL_ROOT_PASSWORD=secret
    - MYSQL_DATABASE=demo
    - MYSQL_USER=demouser
    - MYSQL_PASSWORD=demopassword
  ports:
    - 3306:3306

I noticed that the shell process for docker run is "/entrypoint.sh mysql" but docker-composer runs "docker-entrypoint.sh". Why does docker-entrypoint.sh differ in behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions