Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize create_container input for volumes_from #198

Merged
merged 3 commits into from Apr 23, 2014
Merged

Sanitize create_container input for volumes_from #198

merged 3 commits into from Apr 23, 2014

Conversation

fcoelho
Copy link
Contributor

@fcoelho fcoelho commented Apr 9, 2014

Client.create_container takes a volumes_from argument that should be: a string, a list of strings, or None. If an empty list or dict is passed instead, docker-py throws a weird error:

(env)[root@host ~]# python fail.py 
Traceback (most recent call last):
  File "fail.py", line 6, in <module>
    client.start(container['Id'])
  File "/root/env/lib/python2.7/site-packages/docker/client.py", line 742, in start
    self._raise_for_status(res)
  File "/root/env/lib/python2.7/site-packages/docker/client.py", line 115, in _raise_for_status
    raise APIError(e, response, explanation=explanation)
docker.client.APIError: 406 Client Error: Not Acceptable ("Cannot start container c6d6a22391b092de05b12eb97d8787fb976cf180f5db4e4a8d54b74e73f8c422: Container c6d6a22391b092de05b12eb97d8787fb976cf180f5db4e4a8d54b74e73f8c422 not found. Impossible to mount its volumes")

This happens on docker 0.9.0 and docker-py 0.3.1. There are a few differences from the output of docker inspect for a container created with volumes_from=None or volumes_from=[]. I'll create an issue on dotcloud/docker and link it here when it's done.

Edit: moby/moby#5108

Client.create_container takes a volumes_from argument that should be: a
string, a list of strings, or None. If an empty list or dict is passed
instead, the docker daemon returns a 406 Client Error: Not Acceptable
@shin-
Copy link
Contributor

shin- commented Apr 9, 2014

Thanks! Can you add the case to the unit tests, so we can avoid a regression in the future?

@fcoelho
Copy link
Contributor Author

fcoelho commented Apr 9, 2014

Done, the test just checks whether VolumesFrom is passed or not to the daemon. I didn't write code that actually triggers the exception, as I thought that could change too much of the fake requests data. If you think I should go for that, I'll add changes there too

shin- added a commit that referenced this pull request Apr 23, 2014
Sanitize create_container input for volumes_from
@shin- shin- merged commit 6c1f7f3 into docker:master Apr 23, 2014
@shin-
Copy link
Contributor

shin- commented Apr 23, 2014

No that's great, thanks! (and sorry for the merging delay)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants