docker

How to cleanup RAM between program iterations using Python

How to cleanup RAM between program iterations using Python Question: Problem I have a Python application inside Docker container. The application receives "jobs" from some queue service (RabbitMQ), does some computing tasks and uploads results into database (MySQL and Redis). The issue I face is – the RAM is not properly "cleaned up" between iterations …

Total answers: 1

Scheduled python code can't find module when run in Docker

Scheduled python code can't find module when run in Docker Question: I’m trying to run a python script inside a Docker container every 2 minutes. To achieve this, I am using a cron job. When I run the Python script on the host machine, it executes perfectly, but inside the docker container I keep getting …

Total answers: 3

How to log Python code memory consumption?

How to log Python code memory consumption? Question: Question Hi, I am runnin’ a Docker container with a Python application inside. The code performs some computing tasks and I would like to monitor it’s memory consumption using logs (so I can see how different parts of the calculations perform). I do not need any charts …

Total answers: 2

How to configure a PYTHONPATH env variable in the Dockerfile?

How to configure a PYTHONPATH env variable in the Dockerfile? Question: I am modifying the Machine Learning Inference to perform inference using my trained model and to this it is need to import a set of modules. So the project tree is now: . ├── Dockerfile ├── __init__.py ├── app.py ├── requirements.txt ** └── maskrcnn …

Total answers: 3

Where to securely store Google_Application_Credentials in Django project?

Where to securely store Google_Application_Credentials in Django project? Question: I have a Django project that uses the Google API. I created a docker-compose.yml which has my Django container and Nginx container. It builds successfully but when I run docker-compose up, I get following error: google.auth.exceptions.DefaultCredentialsError: File /file/path/credentials.json was not found. I have installed the Google …

Total answers: 1

Python script called in a .NET API in docker, dependencies not found

Python script called in a .NET API in docker, dependencies not found Question: I have a project with the following folder structure (abstracted): . └── root/ ├── ExRate_Service/ │ ├── MyOwnPythonScripts… │ └── Program.py ├── ExRate_API/ │ ├── ExRate_API/ │ │ ├── Classes… │ │ ├── ExRate_API.csproj │ │ └── Program.cs │ ├── ExRate_API.Tests/ │ …

Total answers: 1

Not able to redirect container logs to file using subprocess.run

Not able to redirect container logs to file using subprocess.run Question: I have a python script to start some containers, wait for them to finish execution and then start a few others. I wanted to get the container logs and this bash command worked for me: docker logs -f container-name &> tmp.log & However when …

Total answers: 1

Docker Compose with Django and Postgres Fails with "django.db.utils.OperationalError: could not connect to server:"

Docker Compose with Django and Postgres Fails with "django.db.utils.OperationalError: could not connect to server:" Question: I am trying to run my django/postgres application with docker compose. When I run docker compose up -d I get the the following logs on my postgres container running on port 5432: 2023-02-18 00:10:25.049 UTC [1] LOG: starting PostgreSQL 13.8 …

Total answers: 1

Error debugging Python in VS Code: "pythonPath" is not valid if "python" is specified

Error debugging Python in VS Code: "pythonPath" is not valid if "python" is specified Question: I get a prompt with: Invalid Message: "pythonPath" is not valid if "python" is specified and the option to open launch.json. But my launch.json doesn’t contain anything that says "pythonPath": { "configurations": [ { "name": "Docker: Python – General", "type": …

Total answers: 3

Why am I getting "Volumes must be mapping" error

Why am I getting "Volumes must be mapping" error Question: Trying to add Django app with a PostgreSQL db to a Docker container. When trying to run "docker-compose build", I am getting a "Volumes must be mapping" error. Not sure what I’m doing wrong as it looks like the : syntax signified a mapping. When …

Total answers: 1