Giter Site home page Giter Site logo

curl about busybox HOT 11 CLOSED

docker-library avatar docker-library commented on May 31, 2024 3
curl

from busybox.

Comments (11)

tianon avatar tianon commented on May 31, 2024 11

If you need more functionality than BusyBox alone, then I'd recommend checking out Alpine, which is basically BusyBox plus their apk package manager (which allows you to easily install curl if you so need, for example).

from busybox.

yosifkit avatar yosifkit commented on May 31, 2024 8

You'd need a statically compiled curl and then COPY it into the image. You could just use wget:

$ docker run -it --rm busybox
/ # curl
sh: curl: not found
/ # wget
BusyBox v1.28.4 (2018-05-22 17:00:17 UTC) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
	[--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
	[-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	--spider	Only check URL existence: $? is 0 if exists
	-c		Continue retrieval of aborted transfer
	-q		Quiet
	-P DIR		Save to DIR (default .)
	-S    		Show server response
	-T SEC		Network read timeout is SEC seconds
	-O FILE		Save to FILE ('-' for stdout)
	-U STR		Use STR for User-Agent header
	-Y on/off	Use proxy
/ # 

from busybox.

qdm12 avatar qdm12 commented on May 31, 2024 3

Why do we have wget but not curl in busybox by the way? If anyone knows 🤔 Why not curl instead of wget?

from busybox.

tianon avatar tianon commented on May 31, 2024 3

BusyBox does not include wget -- BusyBox reimplements a subset of wget (as they do with all the coreutils they include, etc). That's the whole point of BusyBox. The usage patterns of curl are significantly more complex, so implementing a subset of those would be a lot more complicated.

To illustrate:

$ wget --help | wc -l
207

$ docker run --rm busybox wget --help 2>&1 | wc -l
20

$ docker run --rm busybox wget --help
BusyBox v1.32.1 (2021-04-07 19:47:14 UTC) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
	[-o|--output-file FILE] [--header 'header: value'] [-Y|--proxy on/off]
	[--no-check-certificate]
	[-P DIR] [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	--spider	Only check URL existence: $? is 0 if exists
	--no-check-certificate	Don't validate the server's certificate
	-c		Continue retrieval of aborted transfer
	-q		Quiet
	-P DIR		Save to DIR (default .)
	-S    		Show server response
	-T SEC		Network read timeout is SEC seconds
	-O FILE		Save to FILE ('-' for stdout)
	-o FILE		Log messages to FILE
	-U STR		Use STR for User-Agent header
	-Y on/off	Use proxy

If curl is something required for your use case, I would reiterate the advice from above: Alpine is busybox + a minimal package manager and libc implementation such that you can trivially do apk add --no-cache curl and get real curl (or even apk add --no-cache wget to get the "real" wget instead of BusyBox wget).

from busybox.

tianon avatar tianon commented on May 31, 2024 3

I mean, yes, but also very much no: #80 (TLS validation is Broken-By-Design)

from busybox.

adamkdean avatar adamkdean commented on May 31, 2024 1

Aye, I usually use alpine, but in this case I'm extending a busybox based image and need to copy in curl, meaning I need a statically compiled version of curl. I was just commenting on the suggestion of wget as an alternative. Thanks though!

from busybox.

adamkdean avatar adamkdean commented on May 31, 2024

This doesn't help when you need to use more functionality than wget has available, sadly.

from busybox.

yosifkit avatar yosifkit commented on May 31, 2024

Why do we have wget but not curl in busybox by the way? If anyone knows 🤔 Why not curl instead of wget?

Because busybox implements wget and not curl. https://git.busybox.net/busybox/tree/networking/wget.c?h=1_32_stable

from busybox.

qdm12 avatar qdm12 commented on May 31, 2024

Thanks for the answer... although I believe it is the reason of my question 😉 Why isn't busybox supporting curl instead of wget? Is this a size problem? Especially since curl is under an MIT license AFAIK 🤔

from busybox.

qdm12 avatar qdm12 commented on May 31, 2024

Nice thanks so much for the explanations 👍. I would, from my semi ignorant point of view, that it helps to reduce the attack surface since busybox's wget is even simpler than the actual wget.

from busybox.

qdm12 avatar qdm12 commented on May 31, 2024

Oh well, you just blew my mind 😄

So... I guess we should either have openssl somewhere or install e. g. Alpine's wget if we want proper TLS validation for the time being and foreseeable future right? Anyway sorry for the off-topic comment but this is definitely interesting knowledge 😉

from busybox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.