4 ms·
I asked ChatGPT 4o if there's anything that can be improved in your docker-compose file. Among other (seemingly sensible) suggestions, it offered: ## Restrict
by vanviegen 2y ago
I asked ChatGPT 4o if there's anything that can be improved in your docker-compose file. Among other (seemingly sensible) suggestions, it offered:
## Restrict Host Ports for Security
If app and mariadb are only communicating internally, you can remove 3306:3306 to avoid exposing the port to the host machine:
```yaml
ports:
- 3306:3306 # Remove this unless external access is required.
```
So, apparently, ChatGPT doesn't need any more convincing.
- ryan29 2y agoWow. I can honestly say I'm surprised it makes that suggestion. That's great! I don't understand how it gets there though. How does it "know" that's the right thing to suggest when the majority of the online documentation all gets it wrong? I know how I do it. I read the Docker docs, I see that I don't think publishing that port is needed, I spin up a test, and I verify my theory. AFAIK, ChatGPT isn't testing to verify assumptions like that, so I wonder how it determines correct from incorrect.
- kdmtctl 2y agoI suspect there is acsolid corpus of advices online that mention the exposed ports risk. Alongside with flawed examples you mentioned. Narrow request will trigger the right response. That's why LLMs are still requiring basic understanding of what exactly you plan to achieve.
- BeefWellington 2y agoHere GPT is saying the port is only exposed to the host machine (e.g.: localhost), rather than the full local network.