A minimal Docker image based on Alpine Linux has only 5 MB in size, but a lot of tools common for Linux distributions (e.g. curl
) are not installed by default.
In this short note i will show how to install curl
in Alpine container from the command line.
I will also show how to build an Alpine-based Docker image with curl
installed.
Cool Tip: Enter a running Docker container and start a bash
session! Read More →
Install cURL on Alpine
Install curl
on Alpine Linux from the command line:
# apk --no-cache add curl
To install curl
in Alpine-based Docker image, add the following line to a Dockerfile
:
RUN apk --no-cache add curl
Alpine Linux 3.3 and heigher: The --no-cache
option has been added in Alpine Linux 3.3. It allows to install packages with an index that is updated and used on-the-fly and not cached locally.
On the older versions of Alpine, the curl
command can be installed as follows:
RUN apk add --update curl && \ rm -rf /var/cache/apk/*
Cool Tip: Clean up a Docker host! Remove unused Docker containers! Read More →
thanks it worked for my alpine docker container
Now I’m able to ‘heathcheck’ Caddy:2-alpine container.
docker exec -i caddy apk –no-cache add curl
On new container pull and a simple curl based heathcheck works perfectly.
Thanks for this! 🙂
-Glen
It worked for me too. Thanks, very much