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.

Share:
93,530

Related videos on Youtube

Ankur100
Author by

Ankur100

Updated on September 07, 2020

Comments

  • Ankur100
    Ankur100 over 3 years

    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
    • jww
      jww over 6 years
      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.
    • PaulNUK
      PaulNUK over 3 years
      This is on topic as its a programming question about writing docker files.
  • thaJeztah
    thaJeztah over 6 years
    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
    thaJeztah over 6 years
    Also upvoted to compensate for the mysterious down vote :)