Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 1.3 KB

Docker.md

File metadata and controls

21 lines (13 loc) · 1.3 KB

Docker Issues

  • Clean Docker Environment: Sometimes, Docker can cache images or configurations that cause repeated errors. To ensure a fresh environment, the following Docker commands can be used to clean up:
    1. docker kill $(docker ps -q): Stops all running containers.
    2. docker rm $(docker ps -aq): Removes all containers.
    3. docker system prune --volumes -f: Removes all stopped containers, unused networks, images, and optionally, volumes.
    4. docker volume rm $(docker volume ls -q): Removes all unused volumes.

Problem Statement: Docker build fails due to psycopg2 issue

While attempting to build a Docker image, the process fails when trying to install the psycopg2 package, indicating that pg_config is missing. The user has verified that the requirements.txt matches the one provided in the TDD lab, yet the issue persists.

Solution:

Update Dockerfile to include RUN apt-get update && apt-get install -y postgresql-client on Line 23 which are required to build the psycopg2 package.

Alternatively, switch to using the binary package psycopg[binary] to avoid the need for compiling the package and installing additional dependencies.