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

no such file or directory #7

Closed
jessfraz opened this issue Mar 18, 2015 · 10 comments
Closed

no such file or directory #7

jessfraz opened this issue Mar 18, 2015 · 10 comments

Comments

@jessfraz
Copy link

# proof the file is there
root@db2722aaf51d:/# ls /var/run/
docker.sock  lock  utmp

# when i try w httpie
root@db2722aaf51d:/# http http+unix://%2Fvar%2Frun%sFdocker.sock/info

http: error: ConnectionError: ('Connection aborted.', error(2, 'No such file or directory'))

# when i try w curl
root@db2722aaf51d:/# curl-unix-socket unix:///var/run/docker.sock:/info
{"Containers":2,"Debug":1,"DockerRootDir":"/var/lib/docker","Driver":"btrfs","DriverStatus":[],"ExecutionDriver":"native-0.2","ID":"EXI6:MA6J:YU45:24S3:CA6L:37PQ:JLKG:WPWI:5NFP:L3XW:WECP:HWK3","IPv4Forwarding":1,"Images":86,"IndexServerAddress":"https://index.docker.io/v1/","InitPath":"/usr/bin/docker","InitSha1":"","KernelVersion":"4.0.0-rc3","Labels":null,"MemTotal":33343193088,"MemoryLimit":1,"NCPU":8,"NEventsListener":0,"NFd":24,"NGoroutines":53,"Name":"debian","OperatingSystem":"Debian GNU/Linux 8 (jessie)","RegistryConfig":{"IndexConfigs":{"docker.io":{"Mirrors":null,"Name":"docker.io","Official":true,"Secure":true}},"InsecureRegistryCIDRs":["127.0.0.0/8"]},"SwapLimit":1,"SystemTime":"2015-03-18T12:00:18.261465223-07:00"}
@msabramo
Copy link
Contributor

Interesting. I'll take a look. I also didn't know curl could work with unix sockets so thanks for showing that!

@jkbrzt
Copy link
Member

jkbrzt commented Mar 19, 2015

@msabramo It's actually curl-unix-socket which is a tool written in Go, not curl. Btw, I wonder if it would be possible to adopt this nicer URL syntax.

@jessfraz
Copy link
Author

cool! thanks for looking into it.

On Thu, Mar 19, 2015 at 5:29 AM, Jakub Roztočil notifications@github.com
wrote:

@msabramo https://github.com/msabramo It's actually curl-unix-socket
https://github.com/Soulou/curl-unix-socket which is a tool written in
Go, not curl. Btw, I wonder if it would be possible to adopt this nicer
URL syntax.


Reply to this email directly or view it on GitHub
#7 (comment)
.

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

@msabramo
Copy link
Contributor

BTW, I created https://github.com/msabramo/requests-unixsocket (which this is based on) with the thought that perhaps https://github.com/docker/docker-py might be able to use it, so if requests-unixsocket won't work with the docker socket, then I'd like to fix it.

@msabramo
Copy link
Contributor

@jfrazelle: I think this is just a simple typo. You did:

http http+unix://%2Fvar%2Frun%sFdocker.sock/info

And I also got an error when I did that. When I replace the %sF with %2F, it works for me.

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix://%2Fvar%2Frun%2Fdocker.sock/info
HTTP/1.1 200 OK
Content-Length: 780
Content-Type: application/json
Date: Mon, 23 Mar 2015 16:21:21 GMT
Job-Name: info

{
    "Containers": 0,
    "Debug": 0,
    "DockerRootDir": "/var/lib/docker",
    "Driver": "aufs",
    "DriverStatus": [
        [
            "Root Dir",
            "/var/lib/docker/aufs"
        ],
        [
            "Backing Filesystem",
            "extfs"
        ],
        [
            "Dirs",
            "0"
        ]
    ],
    "ExecutionDriver": "native-0.2",
    "ID": "TJON:7OGO:YU6Z:LZ7J:VXUY:BHZK:CNI4:BBXR:ZTGC:V7A6:QB3M:L5K3",
    "IPv4Forwarding": 1,
    "Images": 0,
    "IndexServerAddress": "https://index.docker.io/v1/",
    "InitPath": "/usr/bin/docker",
    "InitSha1": "",
    "KernelVersion": "3.13.0-45-generic",
    "Labels": null,
    "MemTotal": 2099113984,
    "MemoryLimit": 1,
    "NCPU": 2,
    "NEventsListener": 0,
    "NFd": 10,
    "NGoroutines": 14,
    "Name": "vagrant-ubuntu-trusty-64",
    "OperatingSystem": "Ubuntu 14.04.1 LTS",
    "RegistryConfig": {
        "IndexConfigs": {
            "docker.io": {
                "Mirrors": null,
                "Name": "docker.io",
                "Official": true,
                "Secure": true
            }
        },
        "InsecureRegistryCIDRs": [
            "127.0.0.0/8"
        ]
    },
    "SwapLimit": 0
}

Does that solve the issue?

This perhaps points out though that perhaps this URL syntax is error-prone and I should look into adopting the nicer URL syntax that curl-unix-socket uses.

@jessfraz
Copy link
Author

Wow so sorry!

On Monday, March 23, 2015, Marc Abramowitz notifications@github.com wrote:

@jfrazelle https://github.com/jfrazelle: I think this is just a simple
typo. You did:

http http+unix://%2Fvar%2Frun%sFdocker.sock/info

And I also got an error when I did that. When I replace the %sF with %2F,
it works for me.

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix://%2Fvar%2Frun%2Fdocker.sock/info
HTTP/1.1 200 OK
Content-Length: 780
Content-Type: application/json
Date: Mon, 23 Mar 2015 16:21:21 GMT
Job-Name: info

{
"Containers": 0,
"Debug": 0,
"DockerRootDir": "/var/lib/docker",
"Driver": "aufs",
"DriverStatus": [
[
"Root Dir",
"/var/lib/docker/aufs"
],
[
"Backing Filesystem",
"extfs"
],
[
"Dirs",
"0"
]
],
"ExecutionDriver": "native-0.2",
"ID": "TJON:7OGO:YU6Z:LZ7J:VXUY:BHZK:CNI4:BBXR:ZTGC:V7A6:QB3M:L5K3",
"IPv4Forwarding": 1,
"Images": 0,
"IndexServerAddress": "https://index.docker.io/v1/",
"InitPath": "/usr/bin/docker",
"InitSha1": "",
"KernelVersion": "3.13.0-45-generic",
"Labels": null,
"MemTotal": 2099113984,
"MemoryLimit": 1,
"NCPU": 2,
"NEventsListener": 0,
"NFd": 10,
"NGoroutines": 14,
"Name": "vagrant-ubuntu-trusty-64",
"OperatingSystem": "Ubuntu 14.04.1 LTS",
"RegistryConfig": {
"IndexConfigs": {
"docker.io": {
"Mirrors": null,
"Name": "docker.io",
"Official": true,
"Secure": true
}
},
"InsecureRegistryCIDRs": [
"127.0.0.0/8"
]
},
"SwapLimit": 0
}

Does that solve the issue?


Reply to this email directly or view it on GitHub
#7 (comment)
.

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

@msabramo
Copy link
Contributor

@jakubroztocil: It looks like perhaps httpie needs to be modified a bit to support that nicer syntax?

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix:///var/run/docker.sock:/info

http: error: InvalidURL: Invalid URL u'http+unix:///var/run/docker.sock:/info': No host supplied

It's happier with two slashes instead of three (though it still fails because my library doesn't support the new syntax yet):

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix://var/run/docker.sock:/info

http: error: ConnectionError: ('Connection aborted.', error(2, 'No such file or directory'))

@msabramo
Copy link
Contributor

@jfrazelle: No worries. I'm thinking that's a sign that the current syntax is too messy and we should try to have a nicer one like curl-unix-socket does. Interested in helping with that?

@msabramo
Copy link
Contributor

@jakubroztocil: Re my earlier comment; it seems that it's requests that is emitting the No host supplied error:

❯ ag 'No host supplied' requests
requests/requests/models.py
364:            raise InvalidURL("Invalid URL %r: No host supplied" % url)

but maybe there is something that can be done in httpie to avoid hitting that?

@msabramo
Copy link
Contributor

Here's what the stack trace looks like after I commented out the exception handling in httpie:

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~/httpie$ http http+unix:///var/run/docker.sock:/info
Traceback (most recent call last):
  File "/home/vagrant/httpie-unixsocket.venv/bin/http", line 9, in <module>
    load_entry_point('httpie==1.0.0-dev', 'console_scripts', 'http')()
  File "/home/vagrant/httpie/httpie/core.py", line 112, in main
    response = get_response(args, config_dir=env.config.directory)
  File "/home/vagrant/httpie/httpie/client.py", line 41, in get_response
    response = requests_session.request(**kwargs)
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/sessions.py", line 450, in request
    prep = self.prepare_request(req)
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/sessions.py", line 381, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/models.py", line 304, in prepare
    self.prepare_url(url, params)
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/models.py", line 364, in prepare_url
    raise InvalidURL("Invalid URL %r: No host supplied" % url)
requests.exceptions.InvalidURL: Invalid URL u'http+unix:///var/run/docker.sock:/info': No host supplied

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

No branches or pull requests

3 participants