Questions tagged [dockerpy]

The Python API client for Docker

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

191 questions
0
votes
2 answers

How to get the sub directories of docker mounts using python

I'm trying to do automation. For that, I need to check whether the children of the source directory in host system are equal to children directory in the destination directory of the container. docker inspect -f '{{ .Mounts }}' devtest [{bind …
Aaditya R Krishnan
  • 495
  • 1
  • 10
  • 31
0
votes
1 answer

Docker SDK Python run container if it isn't aleardy running

My goal is to only run the container if it isn't already running. What I tried is using client.containers.get(containername) and checking if it is None but that won't work because it returns an error message and not a bool. if…
user11946462
0
votes
0 answers

how to get the volume size in docker-py

I need to find the space occupied by a volume in a container. In order to check whether it crossed the threshold or not. Suppose a container is mounted in myvolume1 and I need to get the total space used by it, free space available on it. From this,…
Aaditya R Krishnan
  • 495
  • 1
  • 10
  • 31
0
votes
1 answer

What is the equivalent command for docker port CONTAINER in docker-py

I trying to automate a docker server using docker-py. Need to check whether the host URL is pinging or not using python. Hence I need an equivalent command in python for docker port container. docker port container_id import docker client =…
user7488258
0
votes
1 answer

How to automate a docker server using python

I'm a newbie in docker and planning to automate a docker server using python. Hence I need to know how to check whether the docker is up or not, the container is up or not, server disk space utilization and so on. I need some hints to proceed.
user8113734
0
votes
1 answer

How fix no basic auth credentials error wit hdockerpy and aws ecr repo?

I m trying to execute the folowing python code: import logging import sys import docker, boto3 from base64 import b64decode logging.basicConfig(stream=sys.stdout, level=logging.INFO) LOCAL_REPOSITORY =…
Cherry
  • 31,309
  • 66
  • 224
  • 364
0
votes
2 answers

Using pipes with docker-py

In the example at https://github.com/docker/docker-py, they return the results of a command to a docker image as so: >>> client.containers.run("ubuntu:latest", "echo hello world") 'hello world\n' What I want is to use a pipe - for instance, it…
lightning
  • 389
  • 1
  • 9
0
votes
0 answers

Turning detached process into asynchronous task

Is it possible to turn docker run command with detach=True into an asynchronous task? I am planning on running a continuous application that reads data from Kafka/RabbitMQ and processes it in docker containers. I can do this in a blocking way…
Bociek
  • 1,195
  • 2
  • 13
  • 28
0
votes
1 answer

Get docker preferences using docker-py

I am trying to read the configs (preferences) set manually using docker preferences on mac from docker-py python module. I see that these preferences are stored in ~/.docker/config.json but I don't seem to find a way to access them using docker…
manji369
  • 186
  • 4
  • 16
0
votes
1 answer

python docker apis containers.run doesnt print output to console

I have pulled alpine image I have build the container I am trying run the image but I do not see any output on my console, anyone whats wrong? If I run using docker run I can see the output Python version is 2.7.10 dockerClient =…
user2511126
  • 620
  • 1
  • 14
  • 31
0
votes
0 answers

Docker multiple machine configurations

I want to know if there is a suggested approach on how to configure Docker machines using configuration files. I have a service that I configure for several users, it is basically a Django app. Until now I had a shared base image and a bunch of…
Pablosproject
  • 1,374
  • 3
  • 13
  • 33
0
votes
2 answers

How to I get the host address using dockerpy of container?

I am trying to figureout from where to get the hostname of a running docker container that was started using docker-py. Based on presence of DOCKER_HOST= file the started docker container my be on a remove machine and not on the localhost (machine…
sorin
  • 161,544
  • 178
  • 535
  • 806
0
votes
1 answer

Jenkins ansible docker_image push to docker registry error

I am trying to push docker image to a remote docker registry via Jenkins and ansible playbook. my ansible is: --- - hosts: localhost remote_user: root vars: git_branch: "{{ GIT_BRANCH|default('development') }}" tasks: - name: Log into…
Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97
0
votes
1 answer

write a file from a docker container in google-cloud-composer

Some context: I'm using composer-1.3.0-airflow-1.10.0 Installed PyPi package docker===2.7.0 For a while I tried to use the DockerOperator, but I need to pull images from a private gcr.io registry located in another gcp-project, and that is a…
donkino
  • 110
  • 1
  • 9
0
votes
1 answer

docker : Capture STDOUT and STDERR in different files using docker client in a python script

I have python script who's responsibility is to run docker image. For running the docker image I am using docker client and the run command is defined like this - def run_docker(self, cred, image, env, volumes, cmd): """ Docker image needs…