Skip to content

fix(docker): improve error handling#142

Merged
coincashew merged 1 commit intomainfrom
d1
Sep 22, 2025
Merged

fix(docker): improve error handling#142
coincashew merged 1 commit intomainfrom
d1

Conversation

@coincashew
Copy link
Copy Markdown
Owner

@coincashew coincashew commented Sep 22, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Installer no longer fails when removing absent packages during pre-install cleanup, making setup smoother across systems.
    • Improved rootless Docker setup by adjusting how the per-user Docker service is enabled and restarted, reducing permission and startup issues.
    • Ensures a usable per-user runtime directory for Docker, increasing installer reliability and first-time success rates.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

The install script tolerates failures when removing old Docker packages, ensures a usable XDG_RUNTIME_DIR for rootless Docker, and switches per-user Docker service commands from systemctl --user ... to sudo systemctl ... (global) for enabling and restarting the docker service in the user context.

Changes

Cohort / File(s) Summary of Changes
Install script adjustments
helpers/install_docker.sh
Append `

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant S as install_docker.sh
  participant A as apt-get
  participant ENV as shell env
  participant SC as systemctl (sudo)

  U->>S: invoke install_docker.sh
  rect rgba(220,235,255,0.25)
    note right of S: Pre-install cleanup (tolerant)
    S->>A: apt-get remove pkg1 || true
    S->>A: apt-get remove pkgN || true
  end

  rect rgba(220,255,220,0.18)
    note right of S: Ensure runtime dir for rootless Docker
    S->>ENV: export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}
  end

  rect rgba(255,240,200,0.18)
    note right of S: Per-user Docker service (rootless)
    S->>SC: sudo systemctl enable docker
    S->>SC: sudo systemctl restart docker
    note right of SC: Replaces `systemctl --user` calls
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I munched the lines with whiskered care,
Tolerant removals now float on air.
I set the run dir, snug and bright,
And nudged services up with sudo might.
Hop—install hums into the night. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix(docker): improve error handling" concisely and accurately summarizes the primary changes in helpers/install_docker.sh—making apt-get removals tolerant and ensuring a usable XDG_RUNTIME_DIR for rootless Docker—so it reflects the main developer intent. It follows conventional commit style, is specific to Docker, and does not include irrelevant noise. A reviewer scanning history will understand the primary change without needing file lists.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch d1

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09b842b and 305104f.

📒 Files selected for processing (1)
  • helpers/install_docker.sh (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • helpers/install_docker.sh

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
helpers/install_docker.sh (1)

9-9: Don’t blanket-suppress apt errors; skip only when package is absent.

|| true hides genuine failures (e.g., dpkg lock), not just “package not installed.” Prefer gating the removal on package presence.

-for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove -y $pkg || true; done
+for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do
+  if dpkg -s "$pkg" >/dev/null 2>&1; then
+    sudo apt-get remove -y "$pkg"
+  fi
+done
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 333f1a9 and 09b842b.

📒 Files selected for processing (1)
  • helpers/install_docker.sh (2 hunks)
🔇 Additional comments (1)
helpers/install_docker.sh (1)

55-60: Align messaging with behavior.

Given the fix above uses systemctl --user for rootless mode, this message is accurate. If you keep any system‑level enable/start in the non‑root path, it becomes contradictory. Please verify final behavior is:

  • root: enable/start system service
  • non‑root: enable/start user service only

@coincashew coincashew merged commit 6381acd into main Sep 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant