I wanted to set up my sideproject on a different computer but the MySQL container got created without root password, default user and default database.
The MySQL part of my docker-compose.yml
:
mysql:
container_name: my_project_mysql
volumes:
- 'dbimage:/var/lib/mysql'
networks:
- my_project
image: 'mysql:8.4'
environment:
MYSQL_DATABASE: /run/secrets/MYSQL_DATABASE
MYSQL_USER: /run/secrets/MYSQL_USER
MYSQL_PASSWORD: /run/secrets/MYSQL_PASSWORD
MYSQL_ROOT_PASSWORD: /run/secrets/MYSQL_ROOT_PASSWORD
restart: unless-stopped
secrets:
- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_ROOT_PASSWORD
Few months ago it worked without any issue.
All the secret files populated with the right data and docker exec mysql env
shows that it sees the secrets, but somewhy the image got created without root password, default user and default db. It looks like it was built without environment variables.
I've tried without secrets as well, but with the same result.
What happened? How to resolve it?