Questions tagged [python-docker]
34 questions
0
votes
1 answer
Executing docker exec concurrently
Actually the docker python sdk is working fine:
https://docker-py.readthedocs.io/en/stable/client.html
But I tried to perform docker exec with asyncio package simultaneously.
It seems not to be possible? How could jenkins do it?
asyncio code:
import…

Nikolai Ehrhardt
- 570
- 4
- 14
0
votes
0 answers
How to connect database is running inside the container container from outside?
I have created postgres docker image using docker-compose up command.
docker-compose up command is also installing some python packages like poetry ,python3,pip etc. once container is up we are executing docker exec container_name poetry run pytest…

Prashant kamble
- 259
- 2
- 4
- 11
0
votes
3 answers
How does one run Great Expectations from Docker using a Dockerfile to build the image
I am pretty new to Great Expectations (GX) and very new to Docker, and now I am trying to combine the two. I can get a Docker image to build just fine, but when I try to run a container, it fails. I can get my GX Checkpoint to run from both the GX…

Timmy Beatty
- 1
- 4
0
votes
0 answers
How to check if Docker is running on machine via python sdk?
I am writing an application in python that is dependent on the python Docker SDK. I noticed that if the user doesn't have docker running on their machine, then the error that is surfaced is not informative. I was looking for some sort of custom…

user2253546
- 575
- 1
- 8
- 18
0
votes
1 answer
Bad Request ("error reading build args: json: cannot unmarshal number into Go value of type string")
Using docker python library,
UID = USER_ID = os.getuid()
GROUP_ID = os.getgid()
USER = getpass.getuser()
HOME = "~"
DIR = os.getcwd()
DOCKER_GID = execute_shell_command('"$(stat -c "%g" /var/run/docker.sock)"', log_path)
…

Gulzar
- 23,452
- 27
- 113
- 201
0
votes
0 answers
Docker-Compose not creating schema from local db while building docker image
I have created a docker-compose file with 2 services web and POSTGRES. When I run the below docker-compose file, it does not create tables that is in my local POSTGRES db. I have provided the environment variables to use. I think it should use these…

Ziv
- 95
- 7
0
votes
1 answer
How to remove network with docker sdk for python?
I am using docker sdk for python.
I am creating a network like so
try:
client.networks.create(name=network_name, check_duplicate=True)
except docker.errors.APIError as ex:
print(f"not recreating existing docker network:…

Gulzar
- 23,452
- 27
- 113
- 201
0
votes
0 answers
aiokafka producer running on one core in a python:buster Docker container achieves very low throughput 1 MiB per second
I have some simple code that to test the performance of aiokafka library. I am using a Windows computer, running Docker for Windows, and a virtual machine with 8 cores.
The library aiokafka seems to achieve abusrdly low producer throughput in this…

tacos_tacos_tacos
- 10,277
- 11
- 73
- 126
0
votes
0 answers
Python script in Docker Container Attach_Socket send not on separate line
I am trying to compile and run python code in Docker.
Dockerfile
FROM python:3
WORKDIR /app
USER root
ADD . .
RUN chmod a+x ./main.py
RUN chmod a+x ./run.sh
ENTRYPOINT ["sh","./run.sh"]
run.sh
#! usr/bin/env bash
timeout --signal=SIGTERM…

xineta5158
- 117
- 1
- 6
0
votes
1 answer
How to add constraints in client.services.create while creating a new service in existing docker swarm Python Docker SDK?
I want to create a service in existing swarm network using python docker sdk. I have a swarm network named test_net.
Installation of library : pip3 install docker
Below is the code used for creating the service
import docker
from docker.types import…

Nisarg Shah
- 379
- 1
- 10
0
votes
1 answer
Python Docker SDK Inside Kubernetes
I followed this link - https://docs.docker.com/engine/api/sdk/examples/ and the docker SDK worked fine while I was using Docker containers. Now that I have moved to K8s, when I run the code I get error like "Container Not Found" . Is there a way to…

Arun Chandramouli
- 77
- 2
- 10
0
votes
1 answer
Docker-Py log with tail option is not working
I'm trying to perform an automation using docker package of python. In that I tried to read the logs with tails with below code, But it is showing nothing.
import docker
z=docker.from_env()
dkg = z.containers.get('').logs(stream =…

Aaditya R Krishnan
- 495
- 1
- 10
- 31
0
votes
0 answers
Running copy command in docker python can't handle asterisk
I am trying to run a docker container to copy files from a volume to a local folder:
import docker
client = docker.from_env()
stdout = client.containers.run(
"alpine",
mounts=[
docker.types.Mount(
"/data_to",
…

Christian
- 1,341
- 1
- 16
- 35
0
votes
1 answer
Sending echo input to stdin to a docker container using docker
Below is my sample c program
#include
int main()
{
int x, y, z;
scanf("%d%d", &x, &y);
printf("%d,%d" ,x,y);
z = x + y;
printf("%d", z);
return 0;
}
I am able to compile the program and…

mounika kommineni
- 75
- 8
0
votes
1 answer
Converting docker run to python docker, issues passing environmental variables
I'm trying to convert the following docker run command to python docker run:
docker run -v ${HOME}/mypath/somepath:/root/mypath/somepath:ro -v /tmp/report/:/root/report -e MY_VAR=fooname DOCKER_IMAGE
and this is what I have so far:
client =…

Stupid.Fat.Cat
- 10,755
- 23
- 83
- 144