Comments (10)
I've started working on a unix socket patch to requests
which will allow this to work.
from docker-py.
Some minor notes so far. The goal will be to reuse as much of the HTTPAdapter as possible and only patch in the places that need to change. Requests is pretty modular, but has pretty complicated connectionpool logic.
requests.Session
has a mount
method that allows for custom protocol handlers to be registered with an associated adapter.
My thinking is that inheriting and initializing the requests.adapter.HTTPAdapter
and overwriting the get_connection
method is the least invasive way to do it.
from docker-py.
See attached patch for a WIP: https://gist.github.com/keeb/bf39ef50677d4b2ae3dd
The biggest hurdle right now is that there is no reliable way to separate a unix socket file from the rest of the parameter string. Separating the two would mean that we'd have to change the interface, which is something I would like to avoid if at all possible.
This would be trivial if we did not use requests but instead used httplib directly.
Thoughts?
from docker-py.
How far along should the patch get? I get the error below but I'm guessing maybe that's expected at this stage.
requests.exceptions.InvalidURL: Invalid URL u'unix:///var/run/docker.sock/v1.4/containers/create': No host supplied
from docker-py.
@kstaken - it's a little backward, but the problem is the URL you're passing in to the client. It should be unix://var/run/docker.sock (notice, only 2 /'s)
a simple test is
import docker
c = docker.Client(base_url="unix://var/run/docker.sock")
print c.version()
from docker-py.
@keeb the URL came from your patch. The default base_url :-)
And wouldn't 3 slashes actually be correct anyway? unix:// is the scheme and then the path is /var/run/docker.sock although it seems maybe that wouldn't work with requests.
from docker-py.
@keeb do commands other than c.version() work for you?
from docker-py.
oh, I see _extract_path is just hard coded to return /version at the moment.
from docker-py.
Patch incoming..
from docker-py.
Thanks @keeb !
from docker-py.
Related Issues (20)
- Mount of volume-subpath which is available in Docker version 26.0.0, build 2ae903e using Python SDK for docker HOT 1
- Remote Docker Registry Auth
- Heredocs in Dockerfiles dont work and show up as blank inside container when building images
- Capturing container logs for a very-short-lived detached container HOT 1
- Create client fails with podman v5.0.1 HOT 1
- Support `cpuperiod` and `cpuquota` container limits for build HOT 1
- Memory and socket leak of docker daemon when using with rootless docker
- Docker build fails with the API, but succeeds with the CLI HOT 2
- Docker logs: Distinction between stdout and stderr in correct order HOT 2
- Support `ClusterVolumeSpec` in the `create_volume` api
- Release new version to pypi HOT 2
- Breaks with requests 2.32.0: Not supported URL scheme http+docker HOT 60
- Missing build and installation steps without using pip
- ResourceWarning: unclosed <socket.socket> [still occuring] HOT 2
- Container.attrs["State"]["Running"] remains False after starting a container HOT 1
- library does not connect to docker service in macbook sylicon HOT 3
- PyPI - docker Integration in Flask app
- Heredocs in COPY statement throws docker.errors.BuildError: COPY failed: no source files were specified
- Support per-call timeouts in APIClient HOT 1
- Tag validation fails on registries with :PORT specified (localhost:5000/example) if I try to build an image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-py.