Questions tagged [dockerpy]

The Python API client for Docker

The Python API client for Docker https://github.com/dotcloud/docker-py

191 questions
1
vote
1 answer

How to run Docker to listen on a specific port to integrate with Jenkins

I am trying to use Jenkins Docker plugin. Unfortunately I am not able to run Docker on RHEL to listen on a specific port yet. I know I have to add: DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock" But in my RHEL installation dont…
Exploring
  • 2,493
  • 11
  • 56
  • 97
0
votes
1 answer

Docker python client cannot connect docker desktop

I'm using docker-desktop on ubuntu18.04 and I run some containers successfully with it. I try to use docker python client as client = docker.from_env() but it failed as follows: Traceback (most recent call last): File…
MissSirius
  • 152
  • 11
0
votes
0 answers

Send stdin into docker container

Send stdin into docker container in docker-py stdin type string In container, there is a a.py file in /app print(input()) In out of container, I use: import docker client = docker.from_env() container = client.containers.run("input_t", detach =…
0
votes
1 answer

Docker inside docker: file missing

I am launching docker inside another docker container and I'm trying to make files visible inside "deepest" container. My first container is build on python:3.8-slim image, entrypoint is ["python"] and is called test-client. I launch it as docker…
sashaaero
  • 2,618
  • 5
  • 23
  • 41
0
votes
0 answers

Docker SDK - Can't connect to DB from HOST

I want to create a temporary MySQL database for unit testing in Python. I decided to go with docker as the tests will be run on different machines. As a first thing I run the container: client = docker.from_env() container =…
Milano
  • 18,048
  • 37
  • 153
  • 353
0
votes
1 answer

is docker-py/dockerpy secure to use?

I've been reading about security issues with building docker images within a docker container by mounting the docker socket. In my case, I am accessing docker via an API , docker-py. Now I am wondering, are there security issues with building images…
foobar8675
  • 1,215
  • 3
  • 16
  • 26
0
votes
0 answers

How to update the Image of a Docker container with python?

I am trying to update the image of a running docker container using the docker library for python. To update the image, my script executes the following steps: look for containers with the given image name pull the image from the registry create…
Luxaaa
  • 41
  • 1
  • 6
0
votes
1 answer

subprocess.Popen with docker -c command

Why process = subprocess.Popen(command, stdout=subprocess.PIPE) is not working for such command? ['docker', 'exec', 'hungry_keller', 'bash', '-c', ' ""ls -l""] docker exec hungry_keller bash -c "ls -l" and returns: No such file or…
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…
0
votes
1 answer

How to run docker with specific apps version?

I'm using docker with python,when I need install some specific version of apps I docker remains me: => ERROR [3/3] RUN pip install cx-Oracle == 7.0.0 pandas == 1.1.2 my code in Dockerfile: # Dockerfile, Image, Container From python:3.7.9 ADD…
William
  • 3,724
  • 9
  • 43
  • 76
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

how to get a line for line output stream from .exec_run docker-py

Looking for a solution to return the live output when executing commands inside a container using the .exec_run method. ** The scenario is for a currently running container ** Executing a command inside the container this way functions as…
0
votes
0 answers

Running running and interacting with docker from python

I have a simple python code I want to run inside a docker container. print("Starting") while True: stdin = input() print('read: ', stdin) if stdin == 'end': break print("Closing") The docker container is an instance of an image…
Hudler
  • 23
  • 3
0
votes
1 answer

docker-py: Login to private registry using ~/.docker/config.json auth token

I stored my credentials to access a private registry in the ~/.docker/config.json file. Therefore I can simply run docker login without explicitely stating my credentials. Is there a way to replicate this behaviour using docker-py? All I could…
Natjo
  • 2,005
  • 29
  • 75
0
votes
1 answer

How do I copy a file to docker image when building dynamically

I'd like to build a docker image dynamically using Python/docker-py. My sample code is shown below. The problem is that I run into the Forbidden path outside the build context error at the COPY command. I don't know where to place my build.sql…
SteveJ
  • 3,034
  • 2
  • 27
  • 47