Skip to content

BUG: Replace empty db/Dockerfile with official mongo image reference in docker-compose #42

Description

@DewaldOosthuizen

Summary

The db/Dockerfile is completely empty — it contains no instructions. Docker builds a blank intermediate layer and docker-compose uses it as the MongoDB service. The commented-out line in docker-compose.yml already suggests the correct approach: use the official mongo image directly.

Background

An empty Dockerfile is misleading and fragile. It works only because Docker falls back to scratch, but the resulting image is the python:3.11-slim base image without MongoDB binaries — it relies on Docker's layer cache or the host having pulled mongo previously. This is non-deterministic and confusing for learners.

Affected Areas

  • db/Dockerfile — empty file
  • docker-compose.ymlmy_db service build directive

Recommended Fix

Remove db/Dockerfile and update docker-compose.yml:

  my_db:
    image: mongo:7.0
    restart: unless-stopped

Delete the db/ directory entirely if no other files are present.

Acceptance Criteria

  • db/Dockerfile removed
  • my_db service uses image: mongo:7.0 (or latest stable)
  • docker-compose up starts MongoDB correctly
  • /hello and /register endpoints respond as expected

Complexity Estimate

XS — two-line compose change, file deletion.

Priority

Medium — currently non-deterministic behaviour that silently works on some machines and fails on others.


Auto-identified by workspace issue-logger
Category: coding standards / style / linting
Complexity: XS
Repository: DewaldOosthuizen/python_rest_tutorial

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesPull requests that update a dependency fileenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions