Add Docker Compose for local MongoDB development#16
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e43bf84e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| container_name: springboot-restapi-mongodb | ||
| restart: unless-stopped | ||
| ports: | ||
| - "27017:27017" |
There was a problem hiding this comment.
Bind MongoDB to localhost only
For local development on a host where Docker-published ports are reachable from other machines, this exposes the unauthenticated MongoDB instance beyond the developer's machine. The README describes the service as being on localhost:27017, but Docker's port-publishing docs say mappings without a host address publish to all host addresses (0.0.0.0 and [::]); use 127.0.0.1:27017:27017 to keep this dev database local.
Useful? React with 👍 / 👎.
Motivation
MONGODB_URIwork out-of-the-box with a documented Docker Compose setup.Description
docker-compose.ymlthat runsmongo:7, maps27017:27017, persists data to a namedmongodb_datavolume, and includes amongoshping healthcheck.README.mdto recommend Docker/Docker Compose for local development and showdocker compose up -d mongodbto start MongoDB.README.mdfor running the application locally with./gradlew bootRunand for stopping/removing the Compose resources withdocker compose downanddocker compose down -v, and note the defaultMONGODB_URI=mongodb://localhost:27017/rest_tutorialworks with the Compose service.Testing
./gradlew test, but it was blocked because the environment could not download the Gradle distribution fromservices.gradle.org(network unreachable).docker compose config, but it was blocked because the Docker CLI is not installed in the execution environment.Codex Task