This is pretty neat if all you need is to ping a local server but please use curl (or something equivalent) for contacting remote services. HTTP1.1 seems like such a simple protocol but in the real world you need to deal with proxies, different encodings, and redirects. Curl takes care of that (and a host of other annoying stuff) for you.
mrshu 49 minutes ago [-]
I ran into this while checking connectivity between containers on an internal Docker network where the image had neither curl nor wget.
The main surprise was that Bash has /dev/tcp which lets you do the equivalent of an HTTP request with a bit of shell magic, for instance:
Where `service` is just the hostname of whatever you’re talking to and 8642 is the port you are trying to talk HTTP to.
Pretty cool!
sevenzero 13 minutes ago [-]
It seems pretty cool, but I am wondering if there's any drawback on just using images that support curl? I can't think of any and to me it's kinda a must have, even on production images
bravetraveler 3 minutes ago [-]
Some production environments set off alarms around, or outright block, unknown images. Household names that are more bureaucratic than you can imagine. A curiosity for you, necessity for others.
sc68cal 10 minutes ago [-]
That's pretty neat, thanks for sharing
Rendered at 17:29:59 GMT+0000 (Coordinated Universal Time) with Vercel.
The main surprise was that Bash has /dev/tcp which lets you do the equivalent of an HTTP request with a bit of shell magic, for instance:
Where `service` is just the hostname of whatever you’re talking to and 8642 is the port you are trying to talk HTTP to.Pretty cool!