Fix urlencoding of Docker API requests

Docker API requests were broken by urlencoding introduced in commit:
 9fa622780f708644778bbe62d11991b30892833c

The problem with this patch was that a simple urllib.quote()
was performed against the entire URL, although this would
always escape the following characters which were only conditionally
supposed to be quoted: ? & =

By parameterizing the requests and using urllib.urlencode(), we
can apply the quoting only to the components of the URL which
require percent-encoding.

Furthermore, this allows us to well-form and properly quote the
request's path.

Change-Id: I8c5aa26ec96e3bc7b0233aa2aaa6b15afd26bf9e