I'm new to docker and I get a strange error when building my first containers. I'm using WSL2 if that matters.
Here is the part that's causing it :
# MySQL Service
mysql:
image: mysql:8
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: usr_data
volumes:
- ./.docker/mysql/my.cnf:/etc/mysql/conf.d/my.cnf
# - ./.docker/mysql/ohmy.cnf:/etc/mysql/conf.d/my.cnf
- ./.docker/test/test.txt:/tmp/test/test.txt
- mysqldata:/var/lib/mysql
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u root --password=MYSQL_ROOT_PASSWORD
interval: 5s
retries: 10
Both files my.cnf and ohmy.cnf exist and have the same content.
When I use docker-compose up -d I get the error :
ERROR: for mysql Cannot create container for service mysql: not a directory
When I uncomment the ohmy.cnf line and comment the my.cnf line I get no errors and it builds just fine. It also works great with the little test.txt I made.
I fail to see the difference between the two, and while it may work with my little workaround, I'd like to understand what is causing the error in the first place.
Thank you for your time.
Edit : Here's my ./.docker
./.docker
├── mysql
│ ├── db
│ │ └── db.sql
│ ├── my.cnf
│ └── ohmy.cnf
├── nginx
│ └── conf.d
│ └── php.conf
├── php
│ └── Dockerfile
└── test
└── test.txt
6 directories, 6 files