oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.1k stars 2.67k forks source link

Support `fetch` over UNIX socket #2853

Closed klirix closed 1 week ago

klirix commented 1 year ago

What version of Bun is running?

0.5.9

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Run docker with default config.

await fetch("http+unix:///var/socker/docker.sock")

What is the expected behavior?

HTTP response from unix socket

What do you see instead?

Throws FailedToOpenSocket: Was there a typo in the url or port?

Additional information

No response

klirix commented 1 year ago

https://github.com/oven-sh/bun/pull/2777 should probably solve it

ImLunaHey commented 11 months ago

I really need this for docker API support. Is there anything that can be done to help this along? 🙏

donflopez commented 9 months ago

I hate being the guy, but same here! I can't use Dockerode because of this with Bun. The alternative is to run spawn but is so much trouble to gather all the information :(

isaced commented 7 months ago

I am still unable to use dockerode with Bun. 😭

Jarred-Sumner commented 1 week ago

This was implemented quite awhile ago.

From a guide page:

const unix = "/var/run/docker.sock";

const response = await fetch("http://localhost/info", { unix });

const body = await response.json();
console.log(body); // { ... }