[BUG] Container startup fails with special characters in passwords
GamerBene19 opened this issue · 5 comments
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I've tried setting up the container(s) with
container_name: bookstack_db
environment:
- PUID=100000
- PGID=100000
- TZ=Europe/Berlin
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=bookstackapp
- MYSQL_USER=bookstack
- MYSQL_PASSWORD=${DB_PASS} # same ${DB_PASS} for bookstack containerand
user@host:~/docker-services/bookstack$ cat .env
# MySQL root password
MYSQL_ROOT_PASSWORD=g{#;'jh<u_9kVxqb}&4d
# Password of for bookstack database user
DB_PASS=E[Jt/2)n{'Q,&L;R"S*FBut with these passwords I encounter these two error message at container startup:
bookstack_db | ERROR: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'jh<u_9kVxqb}&4d' ;' at line 1
...
bookstack | Failed to parse dotenv file. Encountered unexpected whitespace at ['E[Jt/2)n{'Q,&L;R"S*F'].
Expected Behavior
I understand the problem occurs because the environment variables are inserted into the config files 1:1. E.g.:
user@host:~/docker-services/bookstack$ docker compose exec webserver grep "DB_PASSWORD" /config/www/.env
DB_PASSWORD='E[Jt/2)n{'Q,&L;R"S*F'I'd would be nice if there was a system automatically escape illegal characters, but I don't know if its feasible.
Perhaps a check that prohibits the container from starting if these characters are detected is more realistic.
Steps To Reproduce
- Create .env file with above contents
- Create docker-compose.yml file (from template) with above enviornment options
- Try to start containers
Environment
No response
CPU architecture
x86-64
Docker creation
See docker-compose section above.Container logs
See error messages above.Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.
If you're adding in special characters, you need to escape the whole ENV line with "
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.
If you're adding in special characters, you need to escape the whole ENV line with
"
Sorry forgot to reply. This was indeed the solution, I was just being dumb - thanks!
This issue is locked due to inactivity