Skip to content

Conversation

@shitalm
Copy link
Contributor

@shitalm shitalm commented Nov 2, 2025

Problem

The Dockerfile had a Python version mismatch between the builder stage (Python 3.12) and the runtime stage (Python 3.13), causing ModuleNotFoundError when running Docker containers.

Solution

Changed the runtime image from python:3.13-slim-bookworm to python:3.12-slim-bookworm to match the builder stage version.

Changes

  • Updated Dockerfile line 25 to use python:3.12-slim-bookworm
  • Ensures venv compatibility between builder and runtime stages

Testing

  • Docker containers now start successfully without ModuleNotFoundError
  • Virtual environment works correctly with matching Python versions

Related

Fixes the issue where Docker containers fail with ModuleNotFoundError: No module named 'postgres_mcp'

- Changed runtime image from python:3.13-slim-bookworm to python:3.12-slim-bookworm
- Matches builder stage Python version (python3.12)
- Fixes ModuleNotFoundError when running Docker containers due to venv incompatibility
@neverinfamous
Copy link
Owner

neverinfamous commented Nov 2, 2025

🎉 Thank you so much @shitalm for this contribution!

You're absolutely right - we had a Python version mismatch between the builder stage (3.12) and runtime stage (3.13). This is our first external contribution across all five of our public projects, and we really appreciate you taking the time to identify and fix this issue!

Review Summary:
Correct diagnosis - The mismatch was causing ModuleNotFoundError due to venv incompatibility
Proper fix - Changing runtime to python:3.12-slim-bookworm matches the builder stage
Well documented - Clear problem/solution description with testing notes

The irony is that lines 26-28 of the Dockerfile even have a comment warning about this exact scenario! 😅

We'll merge this right away and it will be included in our next release.

Welcome to the postgres-mcp community! 🚀

@neverinfamous neverinfamous merged commit a907688 into neverinfamous:main Nov 2, 2025
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