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’s using the official Alpine image.
Prerequisites
- Docker
- Alpine
- sudo privileges
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 jq
and curl
Dockerfile lines you can extend the Dockerfile by using them, or you can even add them in the ENTRYPOINT. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.