Skip to content

Fix docker stop error on Dependabot PRs by handling missing container gracefully#674

Merged
A1L13N merged 2 commits into
mainfrom
copilot/fix-3fffc15d-282b-4f18-8bb2-8024069b57c6
Oct 4, 2025
Merged

Fix docker stop error on Dependabot PRs by handling missing container gracefully#674
A1L13N merged 2 commits into
mainfrom
copilot/fix-3fffc15d-282b-4f18-8bb2-8024069b57c6

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 4, 2025

Problem

The Docker Build & Test workflow was failing on Dependabot PRs with the following error:

Run docker stop education-app
Error response from daemon: No such container: education-app
Error: Process completed with exit code 1.

This occurred in the cleanup step when the workflow attempted to stop a Docker container that didn't exist. The container could be missing for various reasons:

  • The container failed to start due to dependency issues
  • Build failures prevented container creation
  • Previous steps failed before the container was created

Solution

Modified .github/workflows/docker-test.yml to gracefully handle missing containers during cleanup:

  1. Added || true to docker stop command (line 158)

    • Ensures the command succeeds even when the container doesn't exist
    • Prevents workflow failure during cleanup
  2. Added docker rm cleanup step (lines 160-162)

    • Properly removes containers after stopping them
    • Also uses || true to handle missing containers gracefully

Both cleanup steps use if: always() to ensure they run regardless of whether previous steps succeeded or failed.

Testing

Verified that the fix works correctly by:

  • Validating YAML syntax with PyYAML
  • Testing that docker stop nonexistent-container || true returns exit code 0
  • Confirming no other workflows have similar issues

This minimal change ensures Dependabot PRs won't fail due to cleanup errors while maintaining proper container cleanup when containers do exist.

Original prompt

this happens on the dependabot PRs - please fix it Run docker stop education-app
Error response from daemon: No such container: education-app
Error: Process completed with exit code 1.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 4, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

… gracefully

Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Copilot AI changed the title [WIP] this happens on the dependabot PRs - please fix it Run docker stop education-app Error response from daemon: No such container: education-app Error: Process completed with exit code 1. Fix docker stop error on Dependabot PRs by handling missing container gracefully Oct 4, 2025
Copilot AI requested a review from A1L13N October 4, 2025 18:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 4, 2025

🚨 Missing Open Issue Link

This pull request does not reference any open GitHub issue via the Development section.

PRs must be linked to an open issue using GitHub’s "Development" section (on the right sidebar).

How to fix this:

  • Go to the PR page.
  • Use the "Link issue" option in the Development section.
  • Select an appropriate open issue.

This PR will be automatically closed. You can reopen it after linking an open issue.

Thank you!

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 4, 2025

🚨 Missing Open Issue Link

This pull request does not reference any open GitHub issue via the Development section.

PRs must be linked to an open issue using GitHub’s "Development" section (on the right sidebar).

How to fix this:

  • Go to the PR page.
  • Use the "Link issue" option in the Development section.
  • Select an appropriate open issue.

This PR will be automatically closed. You can reopen it after linking an open issue.

Thank you!

@A1L13N A1L13N marked this pull request as ready for review October 4, 2025 18:34
@github-actions github-actions Bot closed this Oct 4, 2025
@A1L13N A1L13N reopened this Oct 4, 2025
@github-actions github-actions Bot closed this Oct 4, 2025
@A1L13N A1L13N merged commit 8fbcaa3 into main Oct 4, 2025
28 checks passed
@A1L13N A1L13N deleted the copilot/fix-3fffc15d-282b-4f18-8bb2-8024069b57c6 branch October 4, 2025 18:44
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.

2 participants