120

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
Ankur100
  • 1,209
  • 2
  • 8
  • 7

1 Answers1

243

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.

Dario Seidl
  • 4,140
  • 1
  • 39
  • 55
user2915097
  • 30,758
  • 6
  • 57
  • 59
  • 86
    Recent 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 run `update`. So the equivalent to your example would be `apk add --no-cache wget` – thaJeztah Jan 16 '18 at 23:59
  • 4
    Also upvoted to compensate for the mysterious down vote :) – thaJeztah Jan 17 '18 at 00:01
  • is apk update still required to update? or is it implied with apk add --no-cache? – majorgear Jun 05 '23 at 21:30