make the mount point for shared.txt reside in the /tmp/ folder because if it resides in the lib folder docker sets the owner of the folder as root inside the container so then when the container exists the test fails to cleanup and remove the shared.txt file, and breaks git as well. |
||
---|---|---|
docker | ||
tests | ||
.gitignore | ||
ChangeLog.md | ||
Dockerfile | ||
LICENSE | ||
MANIFEST.in | ||
README.md | ||
requirements.txt | ||
setup.py | ||
tox.ini |
README.md
docker-py
An API client for docker written in Python
API
docker.Client(base_url='unix://var/run/docker.sock', version="1.4")
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, nocache=False, rm=False)
Similar to thedocker build
command. Eitherpath
orfileobj
needs to be set.path
can be a local path (to a directory containing a Dockerfile) or a remote URL.fileobj
must 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 commit
command. -
c.containers(quiet=False, all=False, trunc=True, latest=False, since=None, before=None, limit=-1)
Identical to thedocker ps
command. -
c.copy(container, resource)
Identical to thedocker cp
command. -
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, privileged=False)
Creates a container that can then bestart
ed. Parameters are similar to those for thedocker run
command except it doesn't support the attach options (-a
) -
c.diff(container)
Identical to thedocker diff
command. -
c.export(container)
Identical to thedocker export
command. -
c.history(image)
Identical to thedocker history
command. -
c.images(name=None, quiet=False, all=False, viz=False)
Identical to thedocker images
command. -
c.import_image(src, repository=None, tag=None)
Identical to thedocker import
command. Ifsrc
is 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,src
needs to be a file-like object or bytes collection. To import from a tarball use your absolute path to your tarball. To load arbitrary data as tarball use whatever you want as src and your tarball content in data. -
c.info()
Identical to thedocker info
command. -
c.insert(url, path)
Identical to thedocker insert
command. -
c.inspect_container(container)
Identical to thedocker inspect
command, but only for containers. -
c.inspect_image(image_id)
Identical to thedocker inspect
command, but only for images. -
c.kill(container)
Kill a container. Similar to thedocker kill
command. -
c.login(username, password=None, email=None)
Identical to thedocker login
command (but non-interactive, obviously). -
c.logs(container)
Identical to thedocker logs
command. -
c.port(container, private_port)
Identical to thedocker port
command. -
c.pull(repository, tag=None)
Identical to thedocker pull
command. -
c.push(repository)
Identical to thedocker push
command. -
c.remove_container(container, v=False)
Remove a container. Similar to thedocker rm
command. -
c.remove_image(image)
Remove an image. Similar to thedocker rmi
command. -
c.restart(container, timeout=10)
Restart a container. Similar to thedocker restart
command. -
c.search(term)
Identical to thedocker search
command. -
c.start(container, binds=None, lxc_conf=None)
Similar to thedocker start
command, but doesn't support attach options. Usedocker logs
to recoverstdout
/stderr
binds
Allows to bind a directory in the host to the container. Similar to thedocker run
command with option-v="/host:/mnt"
. Requires the container to be created with the volumes argument:c.create_container(..., volumes={'/mnt': {}})
lxc_conf
allows to pass LXC configuration options in dict form. -
c.stop(container, timeout=10)
Stops a container. Similar to thedocker stop
command. -
c.tag(image, repository, tag=None, force=False)
Identical to thedocker tag
command. -
c.top(container_id)
Identical to thedocker top
command. -
c.version()
Identical to thedocker version
command. -
c.wait(container)
Wait for a container and return its exit code. Similar to thedocker wait
command.