docker,

Add jq and curl on Alpine Docker image

Jan 05, 2022 · 1 min read · Post a comment
Add jq and curl on Alpine Docker image

The official Alpine Docker Image doesn’t contain jq and curl by default. If you need to parse some JSON content or perform some curl checks, you can add them in the Dockerfile that is using the official alpine image.

Prerequisites

  • Docker
  • Alpine

Solution

To add jq and curl open your Dockerfile and add the next lines:

FROM alpine:latest

RUN apk update \
 && apk add --no-cache curl jq \
 && rm -rf /var/cache/apk/*

...

To build the image run:

sudo docker build .

Next run the image with:

sudo docker run <IMAGE-ID>

Conclusion

After the jq and curl Dockerfile lines you can extend the Dockerfile by using them or you can use them in the entrypoint. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on telegram.