Questions tagged python

Explore the latest questions and answers asked by our top developers.

InitContainer run a Python command

I need to run a pip install command in an initcontainer. I´m using the python:3.9-slim-buster image. I created the following code, however I get the following error: /usr/local/bin/python3: No module named pip install moduleexample Code: spec: volumes: – name: agent-volume emptyDir: {} initContainers: – name: dd-apm-init image: python:3.9-slim-buster command: ["python3", "-m", "pip install moduleexample"] resources: […]

By Cabesa92
Published
Categorised as docker, python Tagged ,

Build Docker image [duplicate]

I am trying to run my flask app inside docker I have a simple app.py file app.py When I try to run the code: docker image build -t docker-flask-test . I get an error that says: error message My dockerfile is dockerfile and my requirements.txt file is requirements.txt I am very new to using stack […]

By Sebastian Ng
Published
Categorised as docker, flask, python Tagged , ,

Unable to install python3.7 on ubuntu 16.04

Following from this, I am trying to install like so (in docker, but also same error directly on host): RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:deadsnakes/ppa && apt-get update && apt install -y python3.7 I am getting E: Unable to locate package python3.7 E: Couldn’t find any package by glob […]

By Gulzar
Published
Categorised as docker, installation, linux, python, ubuntu Tagged , , , ,

Google Cloud Run – Executing background job with always-allocated CPU

I have a web app and a background worker service running in Cloud Run. The main app calls the background worker which is essentially just an rq worker wrapped in a thin Flask app to adhere to the runtime contract. The rq worker is spawned via subprocess.Popen. I do not block the main thread with […]

How to build a Docker image?

I have a directory named docker which contains the following two files: docker: |_Dockerfile |_main.py The Dockerfile looks like this: #Specifying the base image FROM python:3.10 #here the dockerfile is pulling the python 3.10 from docker hub which already has python installed so we have all the things we need to have python in our […]

By Gibraltar
Published
Categorised as docker, dockerfile, python Tagged , ,

Install poppler in AWS base python image for Lambda

I am trying to deploy my docker container on AWS Lambda. However, I use pdf2image package in my code which depends on poppler. To install poppler, I need to insert the following line in the Dockerfile. RUN apt-get install -y poppler-utils This is the full view of the dockerfile. FROM ubuntu:18.04 RUN apt-get update RUN […]

By Apezzz
Published
Categorised as aws-lambda, docker, poppler-utils, python, ubuntu Tagged , , , ,

python and docker for module import errors, which is possible to work for both?

current i have a fastapi app that i am developing and try to do testing under 2 machine. 1 with docker and another one without. in this case without docker one, i wanted to launch uvicorn from the terminal as usual uvicorn main:app –reload is possible to run without issue, with my main.py having imports […]

By user1897151
Published
Categorised as docker, fastapi, python Tagged , ,

Can’t launch the selenium remote driver in docker container

I am trying to dockerize my crawler with using selenium and I use the following docker-compose.yml: version: "3" services: chrome: image: selenium/node-chrome:4.1.1-20220121 shm_size: 2gb depends_on: – selenium-hub environment: – HUB_HOST=selenium-hub – HUB_PORT=4444 selenium-hub: image: selenium/hub:4.1.1-20220121 container_name: selenium-hub ports: – "4444:4444" crawler: build: . depends_on: – chrome After that, I am trying to open web browser […]

Postgres in Docker/ Django app does not work – OperationalError: could not connect to server: Connection refused

I have a Django app that runs locally with no problems. Now, I want to get a docker image of my app but when I try to build it, it gives me the following error: django.db.utils.OperationalError: could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections […]

By Daniela
Published
Categorised as django, docker, docker-compose, postgresql, python Tagged , , , ,

Debug while in production mode using nginx

I want to debug my code which is running in docker container using nginx. The enfpoint which I want to reach is available while I use docker-compose up but when I stop one of the containers and run it using IDE, it gives me 502 Bad Gateway error. I have set PyCharm in a way […]

By John
Published
Categorised as docker, flask, nginx, pycharm, python Tagged , , , ,
1 338

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq