Last active
August 29, 2015 14:02
-
-
Save elementalvoid/629641c4e183d9c729eb to your computer and use it in GitHub Desktop.
docker-py volume binding failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import docker | |
client = docker.Client(base_url='unix://var/run/docker.sock', version='1.11', timeout=10) | |
client.pull('busybox', tag='latest') | |
container = client.create_container('busybox:latest', volumes=['/var/run/docker.sock']) | |
# This fails. It's based on https://github.com/dotcloud/docker-py#using-volumes | |
client.start(container, binds={'/var/run/docker.sock': {'bind': '/var/run/docker.sock', 'ro': False}}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
APIError Traceback (most recent call last) | |
<ipython-input-39-53b5ae26cbdd> in <module>() | |
----> 1 client.start(container, binds={'/var/run/docker.sock': {'bind': '/var/run/docker.sock', 'ro': False}}) | |
/usr/local/lib/python2.7/dist-packages/docker/client.pyc in start(self, container, binds, port_bindings, lxc_conf, publish_all_ports, links, privileged) | |
740 url = self._url("/containers/{0}/start".format(container)) | |
741 res = self._post_json(url, data=start_config) | |
--> 742 self._raise_for_status(res) | |
743 | |
744 def stop(self, container, timeout=10): | |
/usr/local/lib/python2.7/dist-packages/docker/client.pyc in _raise_for_status(self, response, explanation) | |
113 response.raise_for_status() | |
114 except requests.exceptions.HTTPError as e: | |
--> 115 raise APIError(e, response, explanation=explanation) | |
116 | |
117 def _result(self, response, json=False, binary=False): | |
APIError: 500 Server Error: Internal Server Error ("Cannot start container 29c79a8de096a2f9b0b8edbaf13e0c49e201bc11ce4dd03b86929633c6ed3094: Invalid bind specification: /var/run/docker.sock:{'bind': '/var/run/docker.sock', 'ro': False}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you tried doing this with the docker CLI? That is, is it a docker.py problem or a general docker problem?
Have you tried giving the container "privileged" status? Not sure how to do this with docker.py. On the commandline it is
--privileged
.