Commit Graph

955 Commits

Author SHA1 Message Date
Davanum Srinivas 9676febae9 Fix to enable streaming container logs reliably
Started a ubuntu container that just runs "ping 8.8.8.8" and tried
the sample code in https://gist.github.com/dims/c3327f633c526847c8e5
to recreate the problem mentioned in:
https://github.com/docker/docker-py/issues/300

To debug the problem i printed the byte array read in recvall
when reading STREAM_HEADER_SIZE_BYTES and realized that the data
being read was far ahead of the actual start of the header documented
in the vnd.docker.raw-stream of the docker remote api. This is
possibly because the requests/urllib3 is reading ahead a bit more
and we shouldn't be trying to hack the internals of those projects.
So just using the documented file-like response.raw is good enough
for us to get the functionality we need which is being able to
read for exactly where the stream header starts. With this change
i can reliably stream the logs just like "docker logs --follow".

Note that we still need to access the underlying socket to set
the timeout to prevent read time outs. The original fix was for
client.logs() only but on further review it made sense to replace
all occurances of _multiplexed_socket_stream_helper with the
new method.
2015-01-19 10:37:14 -05:00
Joffrey F d3a2d900cb Merge pull request #462 from tutumcloud/fix_create_host_config
fix create_host_config method
2015-01-16 10:24:30 -08:00
bernardopericacho 3574167fb0 fix create_host_config method 2015-01-16 15:25:42 +01:00
Joffrey F aa19d7b660 Fixed TestRestartingContainer 2015-01-13 10:32:28 -08:00
Joffrey F d382482378 Merge pull request #460 from docker/0.7.1-release
0.7.1 release
2015-01-12 14:18:30 -08:00
Joffrey F 53ef3c380c Updated version and changelog 2015-01-12 14:16:41 -08:00
Joffrey F 5794b98000 Added deprecation warning for stream parameter in Client.build() 2015-01-12 14:16:13 -08:00
Joffrey F 349c6c5b4f Merge branch 'master' of github.com:docker/docker-py 2015-01-12 12:14:00 -08:00
Joffrey F ba0680d8ce Expanded on boot2docker SSL error resolution 2015-01-12 12:13:37 -08:00
Joffrey F dfd35a05d8 Merge branch 'boot2docker-docs' of https://github.com/ziadsawalha/docker-py into ziadsawalha-boot2docker-docs 2015-01-12 12:08:15 -08:00
Maxime Petazzoni abff0fadf7 Merge pull request #456 from naxhh/patch-1
Fix closing code tag in TLS doc.
2015-01-11 08:29:03 -08:00
Ignacio Tolstoy cc1b3057a9 Fix closing code tag in TLS doc.
Just a quick fix in the docs.
2015-01-11 16:22:08 +01:00
Joffrey F 9e295d666a urllib3/requests issues 2015-01-09 15:24:22 -08:00
Joffrey F 1f8cde8560 Integration tests fixes 2015-01-09 14:22:55 -08:00
Joffrey F 43c334656b Added RO volumes tests 2015-01-08 18:02:03 -08:00
Joffrey F eea01e18ae Revert noop change 2015-01-08 17:03:42 -08:00
Joffrey F 4d3e7eb1cb Merge branch 'master' of https://github.com/rmohr/docker-py into rmohr-master 2015-01-08 16:23:21 -08:00
Joffrey F 7a623c4019 Prioritize system-installed urllib3 over requests vendored urllib3. 2015-01-08 16:12:28 -08:00
Joffrey F 09ea71971c Fix for issue #443 2015-01-08 15:57:44 -08:00
Joffrey F 4f6bbfd0cf Merge branch 'master' of github.com:docker/docker-py 2015-01-08 15:40:30 -08:00
Joffrey F e81ca4ec02 Bump version back to dev 2015-01-08 15:40:20 -08:00
Joffrey F ac6ff5cf0a Merge pull request #453 from kkleidal/registry_auth
removed exception thrown if registry.hub.docker.com is explicitly define...
2015-01-08 11:06:15 -08:00
Ken Leidal 5baa5e4883 removed exception thrown if registry.hub.docker.com is explicitly defined in repository param for client.pull 2015-01-08 13:59:19 -05:00
Sam Thursfield b1d4a5d8d1 Add integration tests for Client.import_image() function
Currently TestImportFromStream fails, because something is going wrong
with the HTTP chunked transfer-encoding. This didn't work before,
either (for a different reason).
2015-01-05 12:33:36 +00:00
Sam Thursfield 8ce1e248cd docs: Add specific import_image() variants 2015-01-05 12:33:36 +00:00
Sam Thursfield 2f3b87a470 Rewrite Client.import_image() and add less-magical versions
Rather than have one function that can do 5 things and attempts to guess
what the user wanted, it's good to have a function for each possible
method of importing an image. Error cases are handled a lot better this
way.

The unit test test_import_image_from_file() was changed to be
test_import_image_from_bytes(), because if we try to import a temporary
file in the test, the 'data' parameter of the 'fake_request' object is
an instance of a funny internal type like <_io.BufferedReader
name='/tmp/tmpc9chux'> and it's very hard to match such a thing with
`mock.assert_called_with()`.
2015-01-05 12:32:56 +00:00
Sam Thursfield 47af951ac8 docs: Clarify import_image() docs 2015-01-05 12:26:29 +00:00
Sam Thursfield 42b91885a2 Rework Unix connection code so that 'chunked' transfers work
This allows streaming a system to the 'import' command, rather than
having to read the whole thing into memory before sending it.

Previously both the UnixAdapter and the docker.Client objects would
track the 'base URL' of the Docker daemon (socket path in the case of
local Unix-domain socket connections). The Client object would construct
URLs which contained the path to the socket with the path of the Docker
API call appended. The UnixHTTPConnection instance would then remove the
known socket path from the URL.

This relied on all calls going through the HTTPConnection.request()
function, where the URL could be rewritten. In the case of 'chunked'
HTTP POST requests this doesn't happen, so such calls would request
a path still including the socket path and would receive a 404 error.

The client now constructs URLs containing just the path of the desired API
endpoint, and expects the Unix socket transport to know the path to the
Docker daemon's socket.
2015-01-05 12:05:39 +00:00
Joffrey F 6a63cb2c96 Update mkdocs.yml 2014-12-27 23:31:58 -08:00
Roman Mohr 2d34c38c4d Keep unix socket alive with python3 2014-12-21 11:42:41 +01:00
Ziad Sawalha 881fe1fd79 Update boot2docker docs with tls workaround 2014-12-20 04:14:45 -06:00
Joffrey F 9b166eea75 Merge pull request #436 from docker/0.7.0-release
0.7.0 release
2014-12-19 09:38:43 -08:00
Joffrey F 2218dbaa67 Use create_host_config in start (unifying parameter processing) 2014-12-18 18:03:27 -08:00
Joffrey F 53d61a77b6 Improved integration tests to run on python3 and close sessions after in tearDown phase 2014-12-18 17:46:41 -08:00
Joffrey F ee53c2d465 Fix create_container environment parameter for python3 2014-12-18 17:44:09 -08:00
Joffrey F 0ec70a2b08 Updated documentation 2014-12-18 11:20:31 -08:00
Joffrey F 29c67c3a05 Added support for extra_hosts in create_host_config 2014-12-18 11:20:31 -08:00
Joffrey F f2ad888ee6 Updated changelog 2014-12-18 11:20:31 -08:00
Joffrey F 6d6583141e Bumped version 2014-12-18 11:20:31 -08:00
Joffrey F 53beba75f4 Merge pull request #427 from abanna/adding_multiple_dockercfg_support
adding the ability to login with different dockercfg files.
2014-12-18 10:39:59 -08:00
Joffrey F 96f66f7558 Merge pull request #435 from dims/fix-flake8-issues
flake8 fails with F821 for unicode under python 3.4.2
2014-12-18 10:33:40 -08:00
abanna 6dfae8bcd2 updated parameter name to make more sense. 2014-12-18 10:21:02 -08:00
abanna d3cf874938 missed a lint error 2014-12-18 10:21:02 -08:00
Alex Banna 4cbf4e312c adding the ability to login with different dockercfg files. 2014-12-18 10:19:40 -08:00
Joffrey F d7a9d9a935 Merge pull request #432 from leth/fix_test_race
Tidy up stream test harness & fix race conditions
2014-12-18 10:18:45 -08:00
Davanum Srinivas d9fa43a9b7 flake8 fails with F821 for unicode under python 3.4.2 2014-12-18 11:08:37 -05:00
Marcus Cobden 17c1869304 Tidy up stream test harness & fix race conditions 2014-12-18 09:23:21 +00:00
Joffrey F 8aded4842b Retry on connection error 2014-12-17 12:55:49 -08:00
Joffrey F f75afc92a2 Use unicode() typecast instead of u'' literal (3.2 compat). Fixes #408 2014-12-17 12:07:35 -08:00
Joffrey F 16379f85c1 Merge branch 'leth-master' 2014-12-17 11:57:23 -08:00