-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Update docker-compose.yml #79
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
base: main
Are you sure you want to change the base?
Conversation
Added ports for mysql file
WalkthroughThe change updates the Changes
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ports: | ||
| -"3306:3306" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Validate and tighten MySQL port exposure
The current port mapping is missing a space after the hyphen (invalid YAML syntax) and opens MySQL on all host interfaces, which can pose a security risk. If you only need localhost access for development, consider the following diff to fix indentation and restrict binding:
services:
db:
image: mysql
container_name: "db_cont"
- ports:
- -"3306:3306"
+ ports:
+ - "127.0.0.1:3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test_dbPlease confirm if external access to MySQL is required; if so, document the intention or apply firewall rules to limit exposure.
🏁 Script executed:
#!/bin/bash
set -e
echo "Lines 35-50 of docker-compose.yml:"
sed -n '35,50p' docker-compose.ymlLength of output: 492
Fix YAML syntax and tighten MySQL port exposure
The ports entry in docker-compose.yml is both invalid YAML (missing a space after the dash) and exposes MySQL on all host interfaces. Unless you explicitly need remote access, bind it to localhost:
• File: docker-compose.yml
Lines: 41–42
services:
db:
image: mysql
container_name: "db_cont"
- ports:
- -"3306:3306"
+ ports:
+ - "127.0.0.1:3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test_dbPlease confirm whether external access is required. If so, document your intention or enforce host-level firewall rules to limit exposure.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ports: | |
| -"3306:3306" | |
| services: | |
| db: | |
| image: mysql | |
| container_name: "db_cont" | |
| ports: | |
| - "127.0.0.1:3306:3306" | |
| environment: | |
| - MYSQL_ROOT_PASSWORD=root | |
| - MYSQL_DATABASE=test_db |
Added ports for mysql file
Summary by CodeRabbit