I have a docker compose file that looks like this:
version: '3.8'
services:
db:
image: mysql
ports:
- 3306:3306
environment:
MYSQL_DATABASE: db
MYSQL_ALLOW_EMPTY_PASSWORD: true
however, I am getting this error when I run docker-compose up:
The Compose file ‘.docker-compose.yml’ is invalid because:
services.db.environment.MYSQL_ALLOW_EMPTY_PASSWORD contains true, which is an invalid type, it should be a string, number, or a null
I don’t really understand why I’m getting this error because I’ve seen other examples of docker compose files with the value set to true. Any advice on what I’m doing wrong here?
2
Answers
Just figured it out. Looks like I needed to change "true" to 1. Here's my final file which works now:
You cannot pass a boolean value, that’s why you are getting this error. "true" (without the quotes) gets converted to True, which is a boolean value.
Looking at the docker hub page it says it only has to be a non-empty value.