Questions tagged [python-docker]
34 questions
4
votes
0 answers
How to get the container log file using docker-py
As part of docker automation am trying to automate certain docker operation using python docker package. Well I have implemented the most of requirement successfully, But could not find an equivalent method for
docker logs
My…

Aaditya R Krishnan
- 495
- 1
- 10
- 31
4
votes
1 answer
How to use exec_run in python docker sdk for replacing my docker cli command
I want to replace the below command with docker python sdk
docker exec 6d9c9b679541 /u01/app/oracle/product/12.0.0/dbhome_1/bin/sqlplus sachin/sachin@orcl @1.sql
here is code i am writing and the error i am getting using python3
>>> import…

Sach
- 161
- 2
- 10
2
votes
1 answer
Install python 3.8 based on .net core 5.0 to Docker
I'm new to use docker and I'm facing to problem to install python in docker based on .net core 5.0
I followed simple tutorials and applied it to server successfully. And I'm trying to apply it to make my own docker file in visual studio(.net core…

takeyourcode
- 375
- 4
- 17
2
votes
2 answers
Is there a way to obtain the date when the docker image was created using docker API for python
I would like to obtain the created at date for a docker image using docker API. Is this possible?
I don't see it in the docs https://docker-py.readthedocs.io/en/stable/images.html.
I see a way to obtain it using requests but was hoping to use docker…

py_noob
- 433
- 2
- 8
- 17
2
votes
2 answers
How to get container name from container ID using python docker module
I would like to get the container name by passing container id. I have tried below for getting that but unfortunately it didn't worked for me.
import docker
def get_container_details(self,container=123456789992):
self.client =…

Aaditya R Krishnan
- 495
- 1
- 10
- 31
1
vote
0 answers
await Docker().containers.get() and .delete() are stuck for some containers, what might be the cause?
On one of three identical machines running Ubuntu:22.04 and Python 3.10.12 I'm encountering a strange problem with aiodocker: await client.containers.get(ident) and await container.delete() are stuck and never return for some (not even running)…

frans
- 8,868
- 11
- 58
- 132
1
vote
0 answers
Why is it that when executing `build docker` I persistently see EOF?
Having gone through different solutions provided on this platform and surfing the web, my error keeps popping up again and again.
I am inclined to drop my question this time around.
While running docker build -t myimage ., I keep on seeing the…

P. Son
- 35
- 6
1
vote
1 answer
Docker for Python get DOCKER_HOST
I'm trying to find the DOCKER_HOST for my docker registry.
Looking at the sdk, I know it's possible to set the DOCKER_HOST.
But is it possible to find the current DOCKER_HOST been used?
import docker
client = docker.from_env()
client.info()

user3292394
- 609
- 2
- 11
- 24
1
vote
1 answer
Python docker keeps saying module not found
I am trying to build a docker to host my Discord bot.
The dockerfile is
FROM python:3.8
COPY ./Elevate/* /docker/
RUN python3.8 -m pip install discord.py==1.5.1
RUN python3.8 -m pip install -r docker/requirements.txt
CMD ["python",…

Teddy Rasmussen
- 46
- 1
- 7
1
vote
0 answers
Can I get the image id of a docker image without building or pulling it from the repo?
I would like to get the images and image ids of a number of docker images (over 100+). I can't pull all these images on my local machine to fetch the image ids. Is there a way using docker api or python gitlab api this would be possible to do? I was…

py_noob
- 433
- 2
- 8
- 17
1
vote
1 answer
Python Docker Container: How to install modules e.g. pymqsl?
I would like to use the module "pymysql" with the official python container https://hub.docker.com/_/python The only way I found so far is to make my own container like this:
FROM python:3
RUN pip install --upgrade pip && \
pip install…

Marc
- 1,088
- 8
- 9
1
vote
1 answer
building docker image using a remote docker file in github using python sdk
I am able to build docker image using python sdk. if the dockerfile is available on my local machine.
client = docker.from_env()
image, build_log = client.images.build(path = "./", tag=image_name,rm=True)
Now, My docker files will be maintained…

karas27
- 335
- 1
- 5
- 15
1
vote
1 answer
How to get container stats details using python docker
I am trying to get the docker container stats inside my python code after running the container as shown below. I am referring to python docker SDk https://docker-py.readthedocs.io/en/stable/index.html to run and get the details of…

mounika kommineni
- 75
- 8
0
votes
0 answers
Python: i have while True loop and it's stops after few hours
My script is running in python docker container. I'm trying to fetch from sola[r] local API with this loop script (code is working, but only few hours):
while True:
startTime = time.time()
try:
data = get_solar_data()
…

Jakubsulla
- 1
- 1
0
votes
0 answers
Specify globals and locals in Python Docker sdk
This is an educational question.
I've read multiple times that python's eval has multiple security threats and that it should be avoided as much as possible. Then I opted for a containerized execution using docker sdk.
Here's a simplified, dummy…

Elle
- 305
- 2
- 10