I have a project that uses mysql, so I've built a container for mysql with docker-compose and it worked. I also have a volume for persistent data and while container is running for the first time it will create a database. However, I droped that database. After running that container again, the database did not recreated. I've tried deleting my container, my image, executed prune process I've also tried
docker-compose down
docker-compose rm
docker-compose stop
docker-compose down --rmi all
I've deleted the volume folder and it didn't help either
This is my folder structer:
mysql/
scripts/
create_users_table.sql
data/
docker-compose.yaml
And this is my docker-compose.yaml file
version: '3.9'
services:
mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_DATABASE: test_db
MYSQL_ROOT_PASSWORD: password
ports:
- 33060:3306
volumes:
- /mysql/data:/var/lib/mysql
- /mysql/scripts:/docker-entrypoint-initdb.d