-
Notifications
You must be signed in to change notification settings - Fork 15
Refactor scripts to support both 'docker compose' and 'docker-compose… #63
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
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.
Pull Request Overview
This PR refactors the Docker Compose-related scripts to support both the newer docker compose command (built into Docker) and the older standalone docker-compose command, improving compatibility across different Docker installation versions.
Key Changes:
- Added automatic detection logic to identify and use the available Docker Compose command variant
- Updated all Docker Compose command invocations to use the dynamically detected command
- Enhanced error handling with clear messages when neither command is found
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| stop.sh | Added detect_docker_compose() function and updated all docker-compose command calls to use the detected variant |
| run.sh | Added detect_docker_compose() function, updated all command calls, and improved container ID detection logic with fallback handling |
| docker-compose.yml | Removed trailing whitespace and added ulimits configuration for blazegraph service |
| .gitignore | Added *.log pattern to ignore log files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Detect docker compose command (newer 'docker compose' vs older 'docker-compose') | ||
| detect_docker_compose() { | ||
| if docker compose version &>/dev/null; then | ||
| echo "docker compose" | ||
| elif docker-compose --version &>/dev/null; then | ||
| echo "docker-compose" | ||
| else | ||
| echo "" | ||
| fi | ||
| } |
Copilot
AI
Nov 18, 2025
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.
The detect_docker_compose function is duplicated identically in both run.sh and stop.sh. Consider extracting this common functionality into a shared utility script (e.g., docker-compose-utils.sh) that can be sourced by both scripts. This would improve maintainability and ensure consistency if the detection logic needs to be updated in the future.
Example:
# In docker-compose-utils.sh
detect_docker_compose() {
if docker compose version &>/dev/null; then
echo "docker compose"
elif docker-compose --version &>/dev/null; then
echo "docker-compose"
else
echo ""
fi
}
# In run.sh and stop.sh
source ./docker-compose-utils.sh| # Detect docker compose command (newer 'docker compose' vs older 'docker-compose') | |
| detect_docker_compose() { | |
| if docker compose version &>/dev/null; then | |
| echo "docker compose" | |
| elif docker-compose --version &>/dev/null; then | |
| echo "docker-compose" | |
| else | |
| echo "" | |
| fi | |
| } | |
| # Source shared docker compose utility functions | |
| source ./docker-compose-utils.sh |
| ulimits: | ||
| nofile: | ||
| soft: 65536 | ||
| hard: 65536 |
Copilot
AI
Nov 18, 2025
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.
[nitpick] The addition of ulimits configuration for the blazegraph service appears to be unrelated to the stated purpose of this PR (refactoring scripts to support both 'docker compose' and 'docker-compose' commands). Consider moving this infrastructure change to a separate PR for better change tracking and review focus.
| ulimits: | |
| nofile: | |
| soft: 65536 | |
| hard: 65536 |
…' commands