Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Container startup fails with special characters in passwords #227

Closed
1 task done
GamerBene19 opened this issue Oct 5, 2024 · 5 comments
Closed
1 task done

Comments

@GamerBene19
Copy link

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 container

and

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*F

But 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

  1. Create .env file with above contents
  2. Create docker-compose.yml file (from template) with above enviornment options
  3. Try to start containers

Environment

No response

CPU architecture

x86-64

Docker creation

See docker-compose section above.

Container logs

See error messages above.
Copy link

github-actions bot commented Oct 5, 2024

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

@j0nnymoe
Copy link
Member

j0nnymoe commented Oct 5, 2024

If you're adding in special characters, you need to escape the whole ENV line with "

@LinuxServer-CI
Copy link
Collaborator

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.

@GamerBene19
Copy link
Author

GamerBene19 commented Nov 7, 2024

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!

@LinuxServer-CI LinuxServer-CI moved this from Issues to Done in Issue & PR Tracker Nov 7, 2024
Copy link

github-actions bot commented Dec 7, 2024

This issue is locked due to inactivity

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

3 participants