Skip to content

Instantly share code, notes, and snippets.

@jbrz0
Created March 26, 2025 02:24
Show Gist options
  • Save jbrz0/bd640d879df69305d16a4c6fb74dfc57 to your computer and use it in GitHub Desktop.
Save jbrz0/bd640d879df69305d16a4c6fb74dfc57 to your computer and use it in GitHub Desktop.
Docker container restart cursorrule
# Docker Container Restart Rule
Description:
This rule directs the AI to provide guidance for restarting Docker containers instead of suggesting direct docker commands. When a container restart is needed, the AI must indicate which container (based on the Dockerfile context) should be restarted and leave the manual execution to the user. Additionally, the AI should verify context to avoid incorrect suggestions such as "npm run dev" when the service is actually running inside a Docker container.
Guidelines:
Restart Relevant Docker Containers:
Analyze the Dockerfile to determine which container(s) are relevant for the current service.
Instruct the user: “Please restart the [container name] Docker container manually” (or similar), without providing a direct docker command.
No Direct Docker Command Execution:
Never output docker commands (e.g., “docker restart …”).
Ensure that all container management instructions are purely advisory and require manual action by the user.
Context-Aware Verification:
Check the context to decide whether suggesting “npm run dev” (or other local commands) is appropriate.
If the service is running inside Docker, avoid local development command suggestions and instruct a container restart instead.
If uncertain about the runtime environment, ask for clarification instead of making assumptions.
Non-Interference with Other Operations:
This rule applies only to Docker-related guidance. Other commands (like file modifications or non-Docker commands) should not be affected.
Error Handling:
If the AI is unsure whether a service is containerized, it should flag the uncertainty and ask for more context rather than suggesting an inappropriate command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment