How to use httpie and jq within docker?
This is the dockerfile of the image you used, see this:
FROM alpine:latestRUN apk add --no-cache jq httpieENTRYPOINT [ "http" ]CMD [ "--help" ]
From above, you can see it set an entrypoint
with http
for this image, so all your command used in docker run
will be act as parameters for http
, so of course you will fail.
Next is a method for you to make use of it:
docker run -it --rm --entrypoint=/bin/sh blacktop/httpie -c "http -b ifconfig.co/json | jq '.ip'"
Sample output:
"92.121.64.197"
Above command will override the default entrypoint
with /bin/sh
, then you can use jq
to parse output of httpie
in pipeline.