Questions tagged [dockerpy]

The Python API client for Docker

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

191 questions
4
votes
1 answer

Wait for docker container healthcheck to succeed before detaching

Is there a way in docker-py to wait for the healthcheck to succeed before detaching the container? I'm trying to do the following but the issue is that .run() returns before the healthcheck is successful. If I try to curl the elasticsearch endpoint…
Bashar
  • 383
  • 4
  • 13
4
votes
1 answer

Python Docker API needs to know the syntax for attach(**kwargs) to container

I am trying to run commands on a container like below: # container started container = PythonDockerAPIs.runContainerWithoutLogs(alpineImage, 'tail -f /dev/null', detach=True) #execute the command cmd1 = container.exec_run('ls -ltr',stream=True,…
user2511126
  • 620
  • 1
  • 14
  • 31
4
votes
1 answer

python docker how to mount the directory from host to container

can someone please share some examples of py apis showing how to mount the directories ? I tried like this but I dont see its working dockerClient = docker.from_env() dockerClient.containers.run('image', 'ls -ltr', volumes={os.getcwd(): {'bind':…
user2511126
  • 620
  • 1
  • 14
  • 31
4
votes
1 answer

How to run docker tag using docker-py

On the command line, you can run docker tag [from] [to] to give an image another name. The documentation does not provide any information on how to do this programmatically. How do you use docker-py to do a docker tag operation?
wonton
  • 7,568
  • 9
  • 56
  • 93
4
votes
3 answers

Login to registry with Docker Python SDK (docker-py)

I am trying to use the Docker Python API to login to a Docker cloud: https://docker-py.readthedocs.io/en/stable/client.html#creating-a-client1 What is the URL? What is the Port? I have tried to get it to work with cloud.docker.com, but I am fine…
Florian Dietz
  • 877
  • 9
  • 20
4
votes
1 answer

How can i force remove a docker container using 'docker_container' module of Ansible?

I am having problems removing containers from my docker host after introducing cadvisor - https://github.com/google/cadvisor/issues/771 I have a large number of Ansible (2.2.1.0) scripts that i use to install my service containers on these docker…
ishan
  • 1,202
  • 5
  • 24
  • 44
4
votes
2 answers

List containers in the same docker-compose

I am working on an application that takes advantage of docker-compose. One of the containers is a watchdog component, that runs a small python script periodically to get the states of the sibling containers, and takes action if one of the containers…
Tamas Hegedus
  • 28,755
  • 12
  • 63
  • 97
4
votes
1 answer

Is there a way for docker-compose to save and open a docker image?

With the native docker client daemon, you can save images to a file and then load them. As an example, from the docs: $ docker save busybox > busybox.tar $ ls -sh busybox.tar 2.7M busybox.tar $ docker save --output busybox.tar busybox $ ls -sh…
enderland
  • 13,825
  • 17
  • 98
  • 152
4
votes
3 answers

link containers with the docker python API

I want to use the docker python API (pip install docker-py) to create a container and link it to an existing container which I created with docker-compose. Using the command line this is easy: docker run --link EXISTING_CONTAINER:LINK_NAME…
flypenguin
  • 655
  • 2
  • 7
  • 21
4
votes
2 answers

docker-py: attach to network before starting the container

Until recently, I could attach a container to a network before starting the container as follows: params = { 'image': 'busybox', 'name': 'test', } result =…
morxa
  • 3,221
  • 3
  • 27
  • 43
4
votes
1 answer

How to run basic web app container in docker-py?

I am trying to mimic running a containerized web app exposed at some port sudo docker run -d -p 1338:1337 kermit/hellonode in Python using docker-py. So far I got this code to start the instance: container = c.create_container('kermit/hellonode',…
metakermit
  • 21,267
  • 15
  • 86
  • 95
3
votes
0 answers

Host key verification failed when building image with docker-compose from a private repo over ssh

Inside my docker-compose.yml I'm using ssh address context to build a Docker image. ui: build: context: git@my.git.host:ui/ui.git dockerfile: Dockerfile.prod container_name: ui ports: - "4200:4200" command: ember…
Dorin
  • 2,482
  • 2
  • 22
  • 38
3
votes
1 answer

Docker CLI allows tag, but Docker Python API raises APIError

I am trying to push a local Docker image to ECR using the Docker Python API. As part of that process I need to tag the image a certain way. When I do so on the CLI, it works: docker tag foo/bar…
Aleksey Bilogur
  • 3,686
  • 3
  • 30
  • 57
3
votes
1 answer

How to get logs when build fails in docker-py?

If I build an image using the high-level docker-py sdk, I get a BuildError on failure., eg try: client.images.build(...) except: print("Hey something wrong with image build!") I know I can use the low level client API to directly hook in…
wonton
  • 7,568
  • 9
  • 56
  • 93
3
votes
1 answer

Docker Container Waiting/Up Time in docker-py library

I am using docker-py (create_container function) to create multiple Docker containers, my code is working properly and creating containers for me and after some time the container exits automatically, but the thing i want to implement here is that,…
Saad
  • 916
  • 1
  • 15
  • 28
1 2
3
12 13