Install packages in Alpine docker
93,530
The equivalent of apt
or apt-get
in Alpine is apk
A typical Dockerfile will contain, for example:
RUN apk add --no-cache wget
--no-cache
is the equivalent to:apk add wget && rm -rf /var/cache/apk/*
or, before the --no-cache option was available:
RUN apk update && apk add wget
Alpine rm -rf /var/cache/apk/*
has the Debian equivalent rm -rf /var/lib/apt/lists/*
.
See the Alpine comparison with other distros for more details.
Related videos on Youtube
Author by
Ankur100
Updated on September 07, 2020Comments
-
Ankur100 over 3 years
How do I write Dockerfile commands to install the following in alpine docker image:
- software-properties-common
- openjdk-8-jdk
- python3
- nltk
- Flask
-
jww over 6 yearsStack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See What topics can I ask about here in the Help Center. Perhaps Super User or Unix & Linux Stack Exchange would be a better place to ask.
-
PaulNUK over 3 yearsThis is on topic as its a programming question about writing docker files.
-
thaJeztah over 6 yearsRecent versions of alpine also allow you to use the
--no-cache
option; using that option, no/var/cache
files are created, and it will automatically runupdate
. So the equivalent to your example would beapk add --no-cache wget
-
thaJeztah over 6 yearsAlso upvoted to compensate for the mysterious down vote :)