Skip to content

Allow overriding --tmpfs for docker container via env var - #38

Merged
aersam merged 4 commits into
mainfrom
tmpfs-env-override
Sep 22, 2026
Merged

aersam merged 4 commits into
mainfrom
tmpfs-env-override

Conversation

@aersam

@aersam aersam commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #37

Adds Docker-level resource overrides for the shared testdb containers (both Postgres and MSSQL), all optional and defaulting to Docker/Podman's own behavior when unset:

  • PGDEVKIT_TESTDB_TMPFS / PGDEVKIT_TESTDB_MSSQL_TMPFS — docker-CLI --tmpfs syntax, semicolon-separated for multiple mounts
  • PGDEVKIT_TESTDB_SHM_SIZE / PGDEVKIT_TESTDB_MSSQL_SHM_SIZE
  • PGDEVKIT_TESTDB_MEM_LIMIT / PGDEVKIT_TESTDB_MSSQL_MEM_LIMIT
  • PGDEVKIT_TESTDB_CPUS / PGDEVKIT_TESTDB_MSSQL_CPUS
  • PGDEVKIT_TESTDB_IMAGE — brings the Postgres container in line with the MSSQL container's existing image override

Parsing/kwarg building is shared between both container modules via a new _docker.resource_kwargs() helper. Version bumped to 0.8.0.

Known limitation (documented in the README and in-code): like the existing HOST/PORT/USER/PASSWORD overrides, these only take effect when pgdevkit actually creates the container — restarting an existing stopped container reuses its original config, so a docker rm is needed after changing any of these on a machine that already has one.

Test plan

  • New unit tests: tests/testdb/test_docker.py (tmpfs spec parsing, resource-kwargs building), extended test_constants.py / test_mssql_constants.py (env var defaults + overrides), extended test_container.py and new test_container_mssql.py (fake-client assertions that the new kwargs are omitted by default and passed through when set)
  • uv run pytest tests/testdb -m "not mssql" — 82 passed, 34 skipped (podman-gated live tests), 3 deselected
  • uv run ty check pgdevkit/testdb — all checks passed

Session: https://claude.ai/code/session_01HhMAd9QaUnmduHbXQsARQG

🤖 Generated with Claude Code

aersam and others added 3 commits September 22, 2026 12:39
… mem_limit, cpus)

Both the Postgres and MSSQL testdb containers now accept env-var overrides
for common docker-run resource knobs that were previously hardcoded/unset:

- PGDEVKIT_TESTDB_TMPFS / PGDEVKIT_TESTDB_MSSQL_TMPFS (docker-CLI --tmpfs
  syntax, semicolon-separated for multiple mounts)
- PGDEVKIT_TESTDB_SHM_SIZE / PGDEVKIT_TESTDB_MSSQL_SHM_SIZE
- PGDEVKIT_TESTDB_MEM_LIMIT / PGDEVKIT_TESTDB_MSSQL_MEM_LIMIT
- PGDEVKIT_TESTDB_CPUS / PGDEVKIT_TESTDB_MSSQL_CPUS
- PGDEVKIT_TESTDB_IMAGE, bringing Postgres in line with the MSSQL
  container's existing image override

All default to Docker/Podman's own defaults when unset. Parsing/kwarg
building lives in _docker.resource_kwargs(), shared by both container
modules.

Closes #37

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HhMAd9QaUnmduHbXQsARQG
Code review flagged that ensure_container()/ensure_mssql_container()
just restart an existing stopped container as-is, so TMPFS/SHM_SIZE/
MEM_LIMIT/CPUS/IMAGE/etc. changes have no effect until it's removed
(docker rm) -- same pre-existing limitation as HOST/PORT/USER/PASSWORD.
Documented in the README and with a short comment at both call sites.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HhMAd9QaUnmduHbXQsARQG
@aersam
aersam marked this pull request as ready for review September 22, 2026 10:44
@aersam
aersam merged commit a0f5d5e into main Sep 22, 2026
2 checks 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.

allow overwrite --tmpfs for docker container via env var

1 participant