Install packages in Alpine docker

LinuxDockerDependenciesDockerfileAlpine

Linux Problem Overview


How do I write Dockerfile commands to install the following in alpine docker image:

  1. software-properties-common
  2. openjdk-8-jdk
  3. python3
  4. nltk
  5. Flask

Linux Solutions


Solution 1 - Linux

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAnkur100View Question on Stackoverflow
Solution 1 - Linuxuser2915097View Answer on Stackoverflow