An API client for docker written in Python
docker.Client(base_url='http://localhost:4243', version="1.3")
Client class. base_url refers to the protocol+hostname+port where the docker
server is hosted. Version is the version of the API the client will use.
- 
c.build(path=None, tag=None, quiet=False, fileobj=None)
Similar to thedocker buildcommand. Eitherpathorfileobjneeds to be set.pathcan be a local path (to a directory containing a Dockerfile) or a remote URL.fileobjmust be a readable file-like object to a Dockerfile. - 
c.commit(container, repository=None, tag=None, message=None, author=None, conf=None)
Identical to thedocker commitcommand. - 
c.containers(quiet=False, all=False, trunc=True, latest=False, since=None, before=None, limit=-1)
Identical to thedocker pscommand. - 
c.create_container(image, command, hostname=None, user=None, detach=False, stdin_open=False, tty=False, mem_limit=0, ports=None, environment=None, dns=None, volumes=None, volumes_from=None)
Creates a container that can then bestarted. Parameters are similar to those for thedocker runcommand except it doesn't support the attach options (-a) - 
c.diff(container)
Identical to thedocker diffcommand. - 
c.export(container)
Identical to thedocker exportcommand. - 
c.history(image)
Identical to thedocker historycommand. - 
c.images(name=None, quiet=False, all=False, viz=False)
Identical to thedocker imagescommand. - 
c.import_image(src, repository=None, tag=None)
Identical to thedocker importcommand. Ifsrcis a string or unicode string, it will be treated as a URL to fetch the image from. To import an image from the local machine,srcneeds to be a file-like object or bytes collection. - 
c.info()
Identical to thedocker infocommand. - 
c.insert(url, path)
Identical to thedocker insertcommand. - 
c.inspect_container(container_id)
Identical to thedocker inspectcommand, but can only be used with a container ID. - 
c.inspect_image(container_id)
Identical to thedocker inspectcommand, but can only be used with an image ID. - 
c.kill(containers...)
Identical to thedocker killcommand. - 
c.login(username, password=None, email=None)
Identical to thedocker logincommand (but non-interactive, obviously). - 
c.logs(container)
Identical to thedocker logscommand. - 
c.port(container, private_port)
Identical to thedocker portcommand. - 
c.pull(repository, tag=None, registry=None)
Identical to thedocker pullcommand. - 
c.push(repository, registry=None)
Identical to thedocker pushcommand. - 
c.remove_container(containers..., v=False)
Identical to thedocker rmcommand. - 
c.remove_image(images...)
Identical to thedocker rmicommand. - 
c.restart(containers..., t=10)
Identical to thedocker restartcommand. - 
c.search(term)
Identical to thedocker searchcommand. - 
c.start(container)
Identical to thedocker startcommand, but doesn't support attach options. Usedocker logsto recoverstdout/stderr - 
c.start(container, binds={'/host': '/mnt'})
Allows to bind a directory in the host to the container. Similar to thedocker runcommand with the-b="/host:/mnt". Requires the container to be created with the volumes argument:c.create_container(..., volumes={'/mnt': {}}) - 
c.stop(containers..., t=10)
Identical to thedocker stopcommand. - 
c.tag(image, repository, tag=None, force=False)
Identical to thedocker tagcommand. - 
c.version()
Identical to thedocker versioncommand. - 
c.wait(containers...)
Identical to thedocker waitcommand.