Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kazukinakai
Copy link
Contributor

@kazukinakai kazukinakai commented Dec 13, 2025

Summary

Adds comprehensive Docker development guidance to the Nx Daemon documentation.

Related to #33263, #30359, #14126

What's included

This PR expands the existing Nx Daemon docs with a new "Running Nx in Docker" section that covers:

  • Why the daemon often fails in Docker - ephemeral filesystems, inode/mtime changes from volume mounts, container restarts, IPC issues
  • Recommended approach - disable daemon with NX_DAEMON=false
  • Example docker-compose setup - minimal reproducible configuration for local development
  • CI/CD best practices - when to prefer stateless builds over daemon caching

Context

Several issues have been opened around daemon behavior in containers, but the existing docs only briefly mention socket location customization. Users are left wondering:

  • Why doesn't the daemon work reliably in Docker?
  • What's the recommended workflow for containerized development?
  • How should CI pipelines handle this?

Issue #33263 specifically describes daemon crashes when running nx between Docker and non-docker environments - this PR documents the recommended workaround (NX_DAEMON=false) and explains why.

Preview

The new section appears under the existing "Customizing the socket location" heading and includes:

  • Explanation of Docker-specific challenges
  • Code examples for Dockerfile, docker-compose, and CLI
  • Rule of thumb callout for quick reference

Open to feedback on structure or placement.

@kazukinakai kazukinakai requested a review from a team as a code owner December 13, 2025 09:04
@kazukinakai kazukinakai requested a review from jaysoo December 13, 2025 09:04
@netlify
Copy link

netlify bot commented Dec 13, 2025

‼️ Deploy request for nx-docs rejected.

Name Link
🔨 Latest commit 1298cc2

@vercel
Copy link

vercel bot commented Dec 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nx-dev Ready Ready Preview Dec 29, 2025 8:34pm

@distante
Copy link

This isn't a correct workaround. Without the NX daemon, you are stuck with services that doesn't reload after changes. You need to manually stop the container and start it again.

@kazukinakai
Copy link
Contributor Author

Good point - you're right that disabling the daemon loses the automatic file watching.

For hot reload without the daemon, the app's bundler (webpack/vite) needs to poll for changes instead:

// webpack.config.js
devServer: {
  watchOptions: {
    poll: 1000,
    ignored: /node_modules/
  }
}

I can add a section covering this trade-off and the polling workaround. Would that address your concern?

@distante
Copy link

I am not on my laptop right now but I think that will not work with projects that runs NestJs applications with the node executor (which is our problem)

@jaysoo
Copy link
Member

jaysoo commented Dec 29, 2025

I updated the wording a bit, and while it does not provide specific guidance on enabling daemon in containers, it at least clarifies why it is automatically disabled in CI and Docker, with the points that @kazukinakai provided.

We can look into a guide for Docker + Daemon in a follow-up. This at least provides users with some information that are currently missing.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Dec 29, 2025

View your CI Pipeline Execution ↗ for commit 3ed270c

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 7m 30s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 39s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 11s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx-cloud record -- nx format:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-29 20:40:15 UTC

@jaysoo jaysoo changed the title docs(nx-daemon): add Docker development guidance docs(core): add Docker development guidance Dec 29, 2025
Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Important

A new CI pipeline execution was requested that may update the conclusion below...

Nx Cloud has identified a possible root cause for your failed CI:

Our format check detected a Prettier violation in inputs.mdoc, but this file wasn't modified in this PR. This appears to be a pre-existing formatting issue in the codebase that's now blocking CI. We should fix the formatting in inputs.mdoc separately to unblock this PR.

No code changes were suggested for this issue.

If the issue was transient, you can trigger a rerun by pushing an empty commit:

git commit --allow-empty -m "chore: trigger rerun"
git push

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

kazuki and others added 2 commits December 29, 2025 15:26
Add comprehensive section explaining:
- Why the daemon often fails in Docker containers
- Recommended approach: disable daemon with NX_DAEMON=false
- Example docker-compose setup for local development
- CI/CD best practices for stateless builds

This addresses common pain points reported in issues nrwl#29384, nrwl#14126, nrwl#30098, and nrwl#8288.
@jaysoo jaysoo force-pushed the docs/docker-daemon-guide branch from c9efeb9 to 3ed270c Compare December 29, 2025 20:28
@jaysoo jaysoo merged commit ab01b21 into nrwl:master Dec 29, 2025
19 checks passed
@jaysoo
Copy link
Member

jaysoo commented Dec 29, 2025

I merged the content since it provide more information for anyone wondering about Docker + Daemon. As I said earlier, we should have a separate guide for using Dev Containers with Daemon, as the CI/production use case without file-watching is fine without daemon, but local development is not.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants