113

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
2
  • Stack 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.
    – jww
    Jan 16, 2018 at 13:44
  • 10
    This is on topic as its a programming question about writing docker files.
    – PaulNUK
    Sep 24, 2020 at 10:45

1 Answer 1

227

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.

2
  • 83
    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, 2018 at 23:59
  • 4
    Also upvoted to compensate for the mysterious down vote :)
    – thaJeztah
    Jan 17, 2018 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.