Questions tagged [dockerpy]

The Python API client for Docker

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

191 questions
6
votes
2 answers

Connecting to Docker-Machine via docker-py on OSX

Context I am trying to use docker-py to connect to docker-machine on OSX. I can't simply use the standard Client(base_url='unix://var/run/docker.sock') since docker is running on a docker-machine Virtual Machine, not my local OS. Instead, I am…
Pedro Cattori
  • 2,735
  • 1
  • 25
  • 43
6
votes
1 answer

Access control for private docker registry

is there a way to access control for push and pull for private docker registry ? I have a machine where I am running a private docker registry like this sudo yum install python-devel libevent-devel python-pip gcc xz-devel sudo python-pip install…
Raghuveer
  • 1,413
  • 3
  • 23
  • 39
6
votes
1 answer

docker-py: Accessing output of python script run in ENTRYPOINT command

I'm having trouble getting the output of a Python script I'm running in a docker container using the docker-py module in Python. First, some context: I've created a Dockerfile and built my image (with id 84730be6107f) in the normal way via the…
acr
  • 531
  • 1
  • 8
  • 8
5
votes
0 answers

docker-py: container STDIN and STDOUT

I'm trying to create run a containerized application using docker-py, and I need to write input data to its STDIN, and read from its STDOUT. Basically this kind of workflow echo "hello" | docker run -i --rm busybox sh -c "cat -" but in Python. In…
5
votes
1 answer

Docker-py: Is there a way to pass a callback function to a container running in 'detach' mode?

I am running a container with docker-py in Python. Similar to the docs: import docker client = docker.from_env() container = client.containers.run('bfirsh/reticulate-splines', detach=True) The container performs some tasks and saves a .json file to…
s.dallapalma
  • 1,225
  • 1
  • 12
  • 35
5
votes
2 answers

Following the exec_run() output from docker-py in realtime

Python noob here, I'm trying to use the exec_run function from docker-py to send commands to a detached docker container and have the output hitting stdout in real time. Here's a MWE: import docker, sys client = docker.from_env() # start a detached…
drgibbon
  • 405
  • 1
  • 4
  • 11
5
votes
2 answers

How to pipe stdout from docker-run in dockerpy

When I run my docker image normally like so docker run -v ..... {DOCKER_IMAGE} I get my log in the terminal as expected. But running like so: docker_client = docker.from_env() container = docker_client.containers.run(DOCKER_IMAGE, None,…
Stupid.Fat.Cat
  • 10,755
  • 23
  • 83
  • 144
5
votes
2 answers

Run a docker container from an existing container using docker-py

I have a Docker container which runs a Flask application. When Flask receives and http request, I would like to trigger the execution of a new ephemeral Docker container which shutdowns once it completes what it has to do. I have read…
Alexis.Rolland
  • 5,724
  • 6
  • 50
  • 77
5
votes
2 answers

API to listen to docker swarm events

I am trying to hook on to docker event bus to listen to various events happening on the swarm such as nodes leaving and joining the cluster, services that are created etc. Questions. Is it possible to get such info at swarm level ?. If so, Does…
B_B
  • 2,013
  • 3
  • 14
  • 13
5
votes
1 answer

Ansible docker_container 'no Host in request URL', docker pull works correctly

I'm trying to provision my infrastructure on AWS using Ansible playbooks. I have the instance, and am able to provision docker-engine, docker-py, etc. and, I swear, yesterday this worked correctly and I haven't changed the code since. The relevant…
DTI-Matt
  • 2,065
  • 9
  • 35
  • 60
5
votes
4 answers

Running multiple commands on the same container using docker-py

I'd like to create a procedure using docker-py to run multiple commands inside a Docker container. Reading the documentation, I have found that I can use the command option when creating the container..something like…
doktoreas
  • 233
  • 3
  • 7
5
votes
0 answers

Jenkins Docker plugin is showing offline

I have integrated the Docker Plugin with Jenkins. I am sure the integration was done success as after installing I checked the "Test Connection" and it showing my Docker version correctly. Now I have trying to provision slave from my build and it is…
Exploring
  • 2,493
  • 11
  • 56
  • 97
4
votes
1 answer

How to run a docker container with specific GPUs using Docker SDK for Python

In the command line I am used to run/create containers with specific GPUs using the --gpus argument: docker run -it --gpus '"device=0,2"' ubuntu nvidia-smi The Docker SDK for Python documentation was not very helpful and I could not find a good…
jokober
  • 694
  • 1
  • 5
  • 18
4
votes
1 answer

Wait for Docker container to become running using Python SDK

Using the docker module for Python, you can start a detached container like this: import docker client = docker.from_env() container = client.containers.run(some_image, detach=True) I need to wait for this container to be running (ie…
Migwell
  • 18,631
  • 21
  • 91
  • 160
4
votes
1 answer

Docker.py how to stop a container with the stdin_open=True?

There is the following code: import docker client = docker.from_env() container = client.containers.create("ubuntu", stdin_open=True) container.start() container.stop() The option stdin_open must be set to True. The stop operations takes 10 seconds…
wulujey
  • 384
  • 1
  • 2
  • 9
1
2
3
12 13