-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: 'docker wait' requires at least 1 argument #36
base: master
Are you sure you want to change the base?
Conversation
interactive mode was not returning the container id which lead to the above error - refactored to fix
WalkthroughThe script has been updated to change how known hosts and SSH configurations are transferred to a Docker container. The previous method used interactive input redirection with the Changes
Sequence Diagram(s)sequenceDiagram
participant Script
participant DockerEngine as Docker Engine
participant Container
Script->>Script: Set `hosts` variable with known hosts content
Script->>DockerEngine: Execute `docker run -d` (append known hosts)
DockerEngine->>Container: Start container in detached mode
Container->>Container: Append known hosts to /etc/ssh/ssh_known_hosts and set permissions
Script->>DockerEngine: Execute `docker run -d` (append SSH configuration)
DockerEngine->>Container: Start container in detached mode
Container->>Container: Append SSH config line
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pre-build (1)
39-48
: Consider adding error handling for Docker commands.While the changes effectively fix the specific issue with
docker wait
, the script could benefit from more robust error handling for Docker operations. Currently, if any Docker command fails for reasons other than exit code (e.g., Docker daemon not running), the script might not provide helpful error messages.- idWithKeys=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $IMAGE /bin/bash -c "echo \"$hosts\" >> /etc/ssh/ssh_known_hosts && chmod 644 /etc/ssh/ssh_known_hosts") + if ! idWithKeys=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $IMAGE /bin/bash -c "echo \"$hosts\" >> /etc/ssh/ssh_known_hosts && chmod 644 /etc/ssh/ssh_known_hosts"); then + dokku_log_fail "Failed to run Docker container for adding known hosts" + fi - idWithConfig=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $IMAGE /bin/bash -c "echo \"UserKnownHostsFile /etc/ssh/ssh_known_hosts\" >> /etc/ssh/ssh_config" ) + if ! idWithConfig=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $IMAGE /bin/bash -c "echo \"UserKnownHostsFile /etc/ssh/ssh_known_hosts\" >> /etc/ssh/ssh_config" ); then + dokku_log_fail "Failed to run Docker container for adding SSH config" + fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
pre-build
(1 hunks)
🔇 Additional comments (2)
pre-build (2)
40-41
: Improved Docker container handling method.This change effectively addresses the PR objective by switching from an interactive mode with input redirection to a detached mode that captures container IDs properly. This ensures the
docker wait
command will always have an argument to work with.
45-45
: Consistent approach for SSH config modification.The modification here follows the same pattern as the known hosts change, switching from interactive mode to detached mode. This ensures reliable container ID capture for the subsequent
docker wait
command.
interactive mode was not returning the container id which lead to the above error - refactored to fix
Summary by CodeRabbit